Приложение падает при загрузке и вообще не вызывает `didFinishLaunchingWithOptions` - PullRequest
1 голос
/ 13 февраля 2020

Я сталкиваюсь со странной проблемой в моем существующем проекте.

С утра я сталкиваюсь с одним странным взломщиком sh от firebase.

Он работал нормально без каких-либо проблем, но с утра Я сталкиваюсь с этой проблемой.

Cra sh:

*** Завершение работы приложения из-за необработанного исключения «NSInternalInconsistencyException», причина: «По умолчанию Экземпляр FIRApp должен быть настроен до инициализации FIRAuthinstance по умолчанию. Один из способов убедиться в этом - вызвать [FIRApp configure]; (FirebaseApp.configure() в Swift) в приложении application:didFinishLaunchingWithOptions: (application(_:didFinishLaunchingWithOptions:) в 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 Вызван didFinishLaunchingWithOptions, все еще сталкивающийся с проблемой cra sh при запуске приложения.

И я заметил, что мой appdelegate didFinishLaunchingWithOptions метод не вызывает, и это вызывает сбой моего приложения.

Редактировать:

Код контроллера просмотра:

var authUI: FUIAuth!

override func viewDidLoad() {
        super.viewDidLoad()
        authUI = FUIAuth.defaultAuthUI()
        authUI?.delegate = self

        if authUI.auth?.currentUser != nil {
            self.checkAdminUser()
            self.getFavPlace()
        }

}

Edit2:

Cra sh Stacktrace:

* Завершение приложения из-за необработанного исключения ' NSInternalInconsistencyException ', причина:' Экземпляр FIRApp по умолчанию должен быть настроен до инициализации FIRAuthinstance по умолчанию. Один из способов убедиться в этом - позвонить по номеру [FIRApp configure]; (FirebaseApp.configure() в Swift) в делегате приложения application:didFinishLaunchingWithOptions: (application(_:didFinishLaunchingWithOptions:) в Swift). ' * Стек вызовов первого выброса: (0 CoreFoundation 0x00007fff23c7127e исключениеPreprocess + 350 1 libobj c .A.dylib
0x00007fff513fbb20 objc_exception_throw + 48 2 CoreFoundation
0x00700_FX + 10x007F: формат 10 * * 0x00700 * 0x007b: 10x * 0x007f: 0x007: 0 * 0x007: 0 * 0x007: 0 * 0x007: 0 * 0x007: 0 * 0x007: 0 * 0x007: 0 * 0x007: 0 * 0x007: 0 * 0x007: 0 * 0x007. :] + 188 3 Herrd
0x000000010559e826 + [FIRAuth аутентификации] + 118 4 Herrd
0x00000001054fe84d $ s5Herrd23TopicNewsViewControllerC5coderACSgSo7NSCoderC_tcf * тысяча восемьдесят-три + 605 5 Herrd 0x00000001054feaa3 $ s5Herrd23TopicNewsViewControllerC5coderACSgSo7NSCoderC_tcfcTo + 51 6 UIKitCore 0x00007fff47cf7268 - [UIClassSwapper initWithCoder:] + 2427 7 UIFoundation 0x00007fff4753d872 UINibDecoderDecodeObjectForValue + 744 8
UIFoundation 0x00007fff4753db19 UINibDecoderDecodeObjectForValue + 1423 9 UIFoundation
0x00007fff4753d57d - [UINibDecoder decodeObjectForKey:] + 251 10 UIKitCore 0x00007fff47cf6531 - [NSCoder (UIIBDependencyInjectionInternal) _decodeObjectsAndTrackChildViewControllerIndexWithParent: forKey:] + 298 11 UIKitCore 0x00007fff47a0e65d - [ UIViewController initWithCoder:] + 1419 12 UIKitCore 0x00007fff4795cc16 - [UINavigationController initWithCoder:] + 65 13 UIFoundation 0x00007fff4753d872 UINibDecoderDecodeObjectForValue + 744 14 UIFoundation
0x00007fff4753db19 UINibDecoderDecodeObjectForValue + 1423 15 UIFoundation 0x00007fff4753d57d - [UINibDecoder decodeObjectForKey:] + 251 16 UIKitCore
0x00007fff47cf6531 - [NSCoder (UIIBDependencyInjectionInternal) _decodeObjectsAndTrackChildViewControllerIndexWithParent: forKey:] + 298 17 UIKitCore 0x00007fff47a0e65d - [UIViewController initWithCoder:] + 1419 18 UIKitCore 0x00007fff4793fbed - [UITabBarController initWithCoder:] + 65 19 UIKitCore 0x00007fff47cf7268 - [UIClassSwapper initWithCoder:] + 2427 20 UIFoundation 0x00007fff4753d872 UINibDecoderDecodeObjectForValue + 744 21 UIFoundation 0x00007fff4753d57d - [UINibDecoder decodeObjectForKey:] + 251 22 UIKitCore
0x00007fff47cfb56f - [UIRuntimeConnection initWithCoder:] + 125 23 UIFoundation 0x00007fff4753d872 UINibDecoderDecodeObjectForValue + 744 24 UIFoundation
0x00007fff4753db19 UINibDecoderDecodeObjectForValue + тысяча четыреста двадцать три 25 UIFoundation 0x00007fff4753d57d - [UINibDecoder decodeObjectForKey:] + 251 26 UIKitCore
0x00007fff47cf6336 - [NSCoder (UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate: Создатель: Отправитель: forKey:] + 450 27 UIKitCore 0x00007fff47cf90a5 - [UINib instantiateWithOwner: опции:] + 1145 28 UIKitCore
0x00007fff481f8f24 - [UIStoryboard __reallyInstantiateViewControllerWithIdentifier: создатель: storyboardSegueTemplate: отправитель:] + 279 29 UIKitCore 0x00007fff481f8dcf - [UIStoryboard _instantiateViewControllerWithIdentifier: создатель: storyboardSegueTemplate: отправитель:] + 97 30 UIKitCore 0x00007fff48091ebf - [UIApplication _loadMainStoryboardFileNamed: bundle:] + + 167 31 UIKitCore 0x00007fff48092473 - [UIApplication _loadMainInterfaceFile] + 274 32 UIKitCore 0x00007fff48090dffr для завершения: UIA - завершение работы: UIA на:] + 964 33 UIKitCore 0x00007fff477c576d - [_ UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene: transitionContext:] + 122 34 UIKitCore 0x00007fff47cb44c1 _UIScenePerformActionsWithLifecycleActionMask + 83 35 UIKitCore 0x00007fff477c627f __101 - [_ UISceneLifecycleMultiplexer _evalTransitionToSettings: fromSettings: forceExit: withTransitionStore:] _ block_invoke + 198 36 UIKitCore 0x00007fff477c5c8e - [_ UISceneLifecycleMultiplexer _performBlock : withApplicationOfDeactivationReasons: fromReasons:] + 296 37 UIKitCore 0x00007fff477c60ac - [_ UISceneLifecycleMultiplexer _evalTransitionToSettings: fromSettings: forceExit: withTransitionStore:] + 818 38 UIKitCore 0x00007fff477c5941 - [_ UISceneLifecycleMultiplexer uiScene: transitionedFromState: withTransitionContext:] + 345 39 UIKitCore 0x00007fff477c9f3f __186 - [_ UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene: withUpdatedFBSScene : settingsDiff: fromSettings: transitionContext: lifecycleActionType:] _ block_invoke_2 + 178 40 UIKitCore 0x00007fff47bd8c83 + [BSAnimationSettings (UIKit) tryAnimatingWithSettings: действия: завершение:] + 865 41 UIKitCore
0x00007fff47cd2dff _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 240 42 UIKitCore 0x00007fff477c9c5a __186 - [_ UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene: withUpdatedFBSScene: settingsDiff: fromSettings: transitionContext: lifecycleActionType:] _block_invoke + 153 43 UIKitCore 0x00007fff47cd2d02 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 84 44 UIKitCore 0x00007fff477c9ac8 - [_ UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene: withUpdatedFBSScene: settingsDiff: fromSettings: transitionContext: lifecycleActionType:] + 381 45 UIKitCore 0x00007fff476206e7 __64- [UIScene сцена: didUpdateWithDiff: transitionContext: завершение:] _ block_invoke + 657 46 UIKitCore 0x00007fff4761f26c - [UIScene _emitSceneSettingsUpdat eResponseForCompletion: afterSceneUpdateWork:] + 248 47 UIKitCore 0x00007fff47620411 - [UIScene сцена: didUpdateWithDiff: transitionContext: завершение:] + 210 48 UIKitCore 0x00007fff4808f599 - [UIApplication рабочее пространство: didCreateScene: withTransitionContext: завершение:] + 535 49 UIKitCore 0x00007fff47bfa7f5 - [UIApplicationSceneClientAgent сцена: didInitializeWithEvent: завершение: 361] + 50 FrontBoardServices 0x00007fff365d6165 - [FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext: завершение:] + 442 51 FrontBoardServices 0x00007fff365fc4d8 __86- [FBSWorkspaceScenesClient sceneID : createWithParameters: transitionContext: завершение:] _ block_invoke.154 + 102 52 FrontBoardServices 0x00007fff365e0c45 - [FBSWorkspace _calloutQueue_executeCalloutFromSource: withBlock:] + 220 53 FrontBoardServices 0x00007fff365fc169 __86- [FBSWorkspaceScenesClient sceneID: createWithParameters: transitionContext: завершение:] _ block_invoke + 355 54 libdispatch.dylib 0x000000010a31dd48 _dispatch_client_callout + 8 55 libdispatch.dylib 0x000000010a320cb9 _dispatch_block_invoke_direct + 300 56 FrontBoardServices 0x00007fff3662237e __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK
30 + 57 FrontBoardServices 0x00007fff3662206c - [FBSSerialQueue _queue_performNextIfPossible] + 441 58 FrontBoardServices 0x00007fff3662257b - [FBSSerialQueue _performNextFromRunLoopSource] + 22 59 CoreFoundation 0x00007fff23bd4471 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 60 CoreFoundation 0x00007fff23bd439c __CFRunLoopDoSource0 + 76 61 CoreFoundation 0x00007fff23bd3b74 __CFRunLoopDoSources0 + 180 62 CoreFoundation
0x00007fff23bce87f __CFRunLoopRun + 63 тысяча двести шестьдесят три CoreFoundation
0x00007fff23bce066 CFRunLoopRunSpecifi * + * тысяча восемьдесят четыре 438 64 GraphicsServices
0x00007fff384c0bb0 GSEventRunModal + 65 65 UIKitCore
0x00007fff48092d4d UIApplicationMain + 1621 66 Herrd
0x000000010552eb0b основных + 75 67 libdyld.dylib
0x00007fff5227ec25 старт + 1 68 ???
0x0000000000000001 0x0 + 1) libc ++ abi.dylib: завершение с необработанным исключением типа NSException

Любая помощь или руководство высоко ценится!

1 Ответ

1 голос
/ 21 февраля 2020

Наконец, я выяснил, почему мое приложение не работает и не вызывает appDidFinshLaunching().

Это из-за одной из TabViewController попыток получить сведения о текущем пользователе до того, как FirebaseApp.configure() будет вызван из делегата приложения.

его напрямую определяют, как показано ниже.

let user = FIRAuth().auth.currentUser

из-за этого он падает.

Я поместил его в метод viewDidLoad(), и теперь приложение работает нормально без каких-либо cra sh.

Спасибо всем за быстрый ответ и помогите мне в этом.

Надеюсь, эта информация поможет другим!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...