Ios 应用程序在加载时崩溃,并且根本没有调用“didFinishLaunchingWithOptions”
我在现有项目中面临一个奇怪的问题 从早上开始,我就面临着来自firebase的一次奇怪的撞击 它工作得很好,没有任何问题,但从早上开始我就面临这个问题 崩溃:Ios 应用程序在加载时崩溃,并且根本没有调用“didFinishLaunchingWithOptions”,ios,swift,firebase,Ios,Swift,Firebase,我在现有项目中面临一个奇怪的问题 从早上开始,我就面临着来自firebase的一次奇怪的撞击 它工作得很好,没有任何问题,但从早上开始我就面临这个问题 崩溃: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { FirebaseApp.confi
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
Messaging.messaging().delegate = self as? MessagingDelegate
self.getRegisterForRemoteNotifications(application)
return true
}
***由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因是:“默认FIRApp
必须先配置实例,然后才能配置默认FirauthinInstance
初始化。确保这一点的一种方法是调用[FIRApp configure]代码>
(FirebaseApp.configure()
在Swift中)在应用程序代理的
应用程序:使用选项完成启动:
(application(u:didfishlaunchingwithoptions:)
在Swift中)。'
它清楚地表明,我需要在我的应用程序委托中实现FirebaseApp.configure()
,并且自过去6个月以来就已经存在了
AppDelegate代码:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
Messaging.messaging().delegate = self as? MessagingDelegate
self.getRegisterForRemoteNotifications(application)
return true
}
你们可以看到Firebase Configure在应用程序启动时仍然面临崩溃问题
我发现我的appdelegate没有使用options
方法完成启动,它没有调用,并使我的应用程序崩溃
编辑:
视图控制器代码:
var authUI: FUIAuth!
override func viewDidLoad() {
super.viewDidLoad()
authUI = FUIAuth.defaultAuthUI()
authUI?.delegate = self
if authUI.auth?.currentUser != nil {
self.checkAdminUser()
self.getFavPlace()
}
}
编辑2:
崩溃堆栈跟踪:
*由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“默认FIRApp
必须先配置实例,然后才能配置默认FirauthinInstance
初始化。确保这一点的一种方法是调用[FIRApp configure]代码>
(FirebaseApp.configure()
在Swift中)在应用程序代理的
应用程序:使用选项完成启动:
(application(u:didfishlaunchingwithoptions:)
在Swift中)。'
*
第一次抛出调用堆栈:(0 CoreFoundation 0x00007fff23c7127e异常预处理+350 1 libobjc.A.dylib
0x00007fff513fbb20对象异常抛出+48 2 CoreFoundation
0x00007fff23c710bc+[N异常升高:格式:][188 3 Herrd
0x000000010559e826+[FIRAuth auth]+118 4 Herrd
0x00000001054fe84d
$s5herrd23TopicNewsViewController5Coderacsgso7nsCodec_tcfc+605
Herrd 0x00000001054feaa3
$s5herrd23TopicNewsViewController5Coderacsgso7nsCoder_tcfcTo+51 6
UIKitCore 0x00007fff47cf7268
-[UIClassSwapper initWithCoder:+2427 7 UIFoundation 0x00007fff4753d872 UIIBdecoderCodeObjectForValue+744 8
UI00007FFF4753DB19
UINIBDecderCodeObjectForValue+1423 9 UIFoundation
0x00007fff4753d57d-[UINibDecoder decodeObjectForKey:+251 10
UIKitCore 0x00007fff47cf6531
-[NSCoder(UIIBDependencyInjectionInternal)\u解码对象和TrackChildViewControllerIndex,其父级为:forKey:+298 11 UIKitCore 0x00007fff47a0e65d
-[UIViewController initWithCoder:+1419 12 UIKitCore 0x00007fff4795cc16-[UINavigationController initWithCoder:+65 13
UI00007FFF4753D872
UINIBDecordeCodeObjectForValue+744 14 UIFoundation
0x00007fff4753db19 UINIBDecordeCodeObjectForValue+1423 15
UIFoundation 0x00007fff4753d57d-[UINibDecoder
decodeObjectForKey:+251 16 UIKitCore
0x00007fff47cf6531-[NSCoder(UIIBDependencyInjectionInternal)
_DecodeObjectsandTrackChildViewControllerIndex与父项:forKey:+298 17 UIKitCore 0x00007fff47a0e65d
-[UIViewController initWithCoder:+1419 18 UIKitCore 0x00007fff4793fbed-[UIAbbarController initWithCoder:+65 19
UIKitCore 0x00007fff47cf7268
-[UIClassSwapper initWithCoder:+2427 20 UIFoundation 0x00007fff4753d872 UIIBdecoderCodeObjectForValue+744 21
UIFoundation 0x00007fff4753d57d-[UINibDecoder
decodeObjectForKey:+251 22 UIKitCore
0x00007fff47cfb56f-[UIRuntimeConnection initWithCoder:+125 23
UI00007FFF4753D872
UINIBDecderCodeObjectForValue+744 24 UIFoundation
0x00007fff4753db19 UINIBDecordeCodeObjectForValue+1423 25
UIFoundation 0x00007fff4753d57d-[UINibDecoder
decodeObjectForKey:+251 26 UIKitCore
0x00007fff47cf6336-[NSCoder(UIIBDependencyInjectionInternal)
_decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:+450 27 UIKitCore 0x00007fff47cf90a5-[UINib
实例化所有者:选项::+1145 28 UIKitCore
0x00007fff481f8f24-[UIStoryboard
__ReallyInstanceEviewController的标识符:创建者:故事板SegueTemplate:发件人:]
+279 29 UIKitCore 0x00007fff481f8dcf-[UIStoryboard\u InstanceiveViewController标识符:创建者:故事板SegueTemplate:发送者:]
+97 30 UIKitCore 0x00007fff48091ebf-[UIApplication\u LoadMainstryBoard文件名:bundle:+167 31 UIKitCore 0x00007fff48092473-[UIApplication
_LoadMain接口文件]+274 32 UIKitCore 0x00007fff48090dff-[UIApplication
_RunWithMain场景:transitionContext:completion:+964 33 UIKitCore 0x00007fff477c576d-[\u UISceneLifecycleMultiplexer
使用FBSSCene完成应用程序启动:transitionContext:+122 34
UIKitCore 0x00007fff47cb44c1
_UISCenePerformanceSwithLifeCycleActionMask+83 35 UIKitCore 0x00007FFF47C627F\uuuu 101-[\uUISCeneLifeCycleMultiplexer
_evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]\u block\u invoke
+198 36 UIKit