在真实设备中调用方法 'FirebaseApp.configure()' 时应用程序崩溃
Application crash when calling method 'FirebaseApp.configure()' in a real device
最近决定在真机上运行应用,收到一个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
AppDelegate:
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 文件中的所有库
- 我试图通过禁用方案中的地址消毒器来解决问题
- 我尝试通过 "Add Files to..."
添加 .plist 文件
- 我试过运行这样的方法:
override init() {
FirebaseApp.configure()
}
- 我在 'Linked Binary With Libraries'
中更新了库
但没有任何帮助。
这可能是因为库映像未在发布版本中加载。查看是否在 'Build Phases'.
的 'Linked Binary With Libraries' 部分检查了库
这是 Apple 阻止免费开发者帐户使用从 iOS 13.3.1 开始的动态框架的另一个症状。
选项包括
- 升级到付费开发者账户
- 降级到 13.3。
- 对于 CocoaPods,使用 use_modular_headers!
而不是 use_frameworks!
另见
最近决定在真机上运行应用,收到一个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
AppDelegate:
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 文件中的所有库
- 我试图通过禁用方案中的地址消毒器来解决问题
- 我尝试通过 "Add Files to..." 添加 .plist 文件
- 我试过运行这样的方法:
override init() {
FirebaseApp.configure()
}
- 我在 'Linked Binary With Libraries' 中更新了库
但没有任何帮助。
这可能是因为库映像未在发布版本中加载。查看是否在 'Build Phases'.
的 'Linked Binary With Libraries' 部分检查了库这是 Apple 阻止免费开发者帐户使用从 iOS 13.3.1 开始的动态框架的另一个症状。
选项包括
- 升级到付费开发者账户
- 降级到 13.3。
- 对于 CocoaPods,使用 use_modular_headers!
而不是 use_frameworks!
另见