ios - 在真实设备中调用方法“FirebaseApp.configure()”时应用程序崩溃
问题描述
最近决定在真机上运行应用,收到一个crash应用,找原因,发现出现在FirebaseApp.configure()方法之后。
该应用程序在模拟器中启动时不会崩溃。
碰撞:
dyld`__abort_with_payload:
0x101b0b2a4 <+0>: mov x16, #0x209
0x101b0b2a8 <+4>: svc #0x80
-> 0x101b0b2ac <+8>: b.lo 0x101b0b2c8 ; <+36>
0x101b0b2b0 <+12>: stp x29, x30, [sp, #-0x10]!
0x101b0b2b4 <+16>: mov x29, sp
0x101b0b2b8 <+20>: bl 0x101b097d8 ; cerror_nocancel
0x101b0b2bc <+24>: mov sp, x29
0x101b0b2c0 <+28>: ldp x29, x30, [sp], #0x10
0x101b0b2c4 <+32>: ret
0x101b0b2c8 <+36>: ret
有了这个回溯:
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0x0000000101b0b2ac dyld`__abort_with_payload + 8
frame #1: 0x0000000101b12914 dyld`abort_with_payload_wrapper_internal + 104
frame #2: 0x0000000101b12948 dyld`abort_with_payload + 16
frame #3: 0x0000000101b0f77c dyld`dyld::halt(char const*) + 380
frame #4: 0x0000000101ac0778 dyld`dyld::fastBindLazySymbol(ImageLoader**, unsigned long) + 176
frame #5: 0x00000001b207963c libdyld.dylib`_dyld_fast_stub_entry(void*, long) + 80
frame #6: 0x00000001b2077b80 libdyld.dylib`dyld_stub_binder + 60
frame #7: 0x0000000100b88258 CheeseApp`__44+[UIViewController(APMScreenClassName) load]_block_invoke + 144
frame #8: 0x000000010204327c libdispatch.dylib`_dispatch_client_callout + 20
frame #9: 0x0000000102044c88 libdispatch.dylib`_dispatch_once_callout + 132
frame #10: 0x0000000100b881c4 CheeseApp`+[UIViewController(APMScreenClassName) load] + 76
frame #11: 0x00000001b1fa1500 libobjc.A.dylib`load_images + 1176
frame #12: 0x0000000101abe19c dyld`dyld::notifySingle(dyld_image_states, ImageLoader const*, ImageLoader::InitializerTimingList*) + 480
frame #13: 0x0000000101ace444 dyld`ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 556
frame #14: 0x0000000101acd094 dyld`ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 192
frame #15: 0x0000000101acd160 dyld`ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 96
frame #16: 0x0000000101abe4f8 dyld`dyld::initializeMainExecutable() + 220
frame #17: 0x0000000101ac3038 dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 4668
frame #18: 0x0000000101abd22c dyld`dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*) + 432
frame #19: 0x0000000101abd038 dyld`_dyld_start + 56
应用委托:
import UIKit
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
我尝试了什么:
- 我更新了根目录中的 GoogleService-Info.plist 文件
- 我更新了 pod 文件中的所有库
- 我试图通过在方案中禁用 Address Sanitizer 来解决问题
- 我尝试通过“将文件添加到...”添加 .plist 文件
- 我试图运行这样的方法:
override init() {
FirebaseApp.configure()
}
- 我在 'Linked Binary With Libraries' 中更新了库
但没有任何帮助。
解决方案
这是 Apple 阻止免费开发者帐户使用从 iOS 13.3.1 开始的动态框架的另一个症状。
选项包括 - 升级到付费开发者帐户 - 降级到 13.3。- 使用 CocoaPods,使用use_modular_headers!
而不是use_frameworks!
另请参阅库未加载:@rpath/FBLPromises.framework/FBLPromises iOS 13.3.1
推荐阅读
- ios - Xcode 12:如何在情节提要中显示状态栏?
- regex - 如何将前瞻正则表达式拆分为 2 个普通正则表达式?
- mongodb - 猫鼬 findOneAndUpdate 过滤
- amazon-mws - 如何通过 MWS 或 SP API 接口上传 FBA Inbound Shipment 纸箱重量和纸箱尺寸信息?
- naivebayes - 如何根据贝叶斯分类器的结果计算 ROC 曲线?
- azure - 关于 YAML 文件中的连字符的问题,何时使用
- angular - 无法为 Angular 应用程序生成代码覆盖率报告
- android - 当 Android 应用程序不存在时,Google Assistant 中的 Action 的 DeepLink 链接?
- python - `variable, _, _ = ...` 在 Python 中是什么意思?
- ios - 如何在 swift 的其他视图中获取响应变量的值...当我尝试访问此变量时它返回 nil...需要解决这个问题