【问题标题】:libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) Errorlibc++abi.dylib:以 NSException (lldb) 类型的未捕获异常终止错误
【发布时间】:2020-09-15 21:21:19
【问题描述】:

我在尝试创建测试用户时收到以下错误代码。程序运行良好,直到我点击“继续”,这是应该使用 Firebase 创建用户的按钮。

(
    0   CoreFoundation                      0x000000010fbf2e6e __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x000000010fa5e9b2 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010fbf2cac +[NSException raise:format:] + 188
    3   Messenger                           0x000000010d56584e +[FIRAuth auth] + 110
    4   Messenger                           0x000000010d555efa $s9Messenger22RegisterViewControllerC20registerButtonTapped33_FFE3ECCAB97030FD54B85ADB55404ED2LLyyF + 2394
    5   Messenger                           0x000000010d55666b $s9Messenger22RegisterViewControllerC20registerButtonTapped33_FFE3ECCAB97030FD54B85ADB55404ED2LLyyFTo + 43
    6   UIKitCore                           0x0000000114443c19 -[UIApplication sendAction:to:from:forEvent:] + 83
    7   UIKitCore                           0x0000000113df2b6a -[UIControl sendAction:to:forEvent:] + 223
    8   UIKitCore                           0x0000000113df2eb2 -[UIControl _sendActionsForEvents:withEvent:] + 396
    9   UIKitCore                           0x0000000113df1e23 -[UIControl touchesEnded:withEvent:] + 497
    10  UIKitCore                           0x0000000113fcc345 _UIGestureEnvironmentUpdate + 9331
    11  UIKitCore                           0x0000000113fc9e94 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 467
    12  UIKitCore                           0x0000000113fc9c1c -[UIGestureEnvironment _updateForEvent:window:] + 225
    13  UIKitCore                           0x0000000114481273 -[UIWindow sendEvent:] + 4479
    14  UIKitCore                           0x000000011445b6cd -[UIApplication sendEvent:] + 356
    15  UIKitCore                           0x00000001144e64ca __dispatchPreprocessedEventFromEventQueue + 7628
    16  UIKitCore                           0x00000001144e968e __handleEventQueueInternal + 6584
    17  UIKitCore                           0x00000001144dff31 __handleHIDEventFetcherDrain + 88
    18  CoreFoundation                      0x000000010fb56c91 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    19  CoreFoundation                      0x000000010fb56bbc __CFRunLoopDoSource0 + 76
    20  CoreFoundation                      0x000000010fb56394 __CFRunLoopDoSources0 + 180
    21  CoreFoundation                      0x000000010fb50f8e __CFRunLoopRun + 974
    22  CoreFoundation                      0x000000010fb508a4 CFRunLoopRunSpecific + 404
    23  GraphicsServices                    0x000000011a3c8bbe GSEventRunModal + 139
    24  UIKitCore                           0x0000000114442964 UIApplicationMain + 1605
    25  Messenger                           0x000000010d55c62b main + 75
    26  libdyld.dylib                       0x00000001122c21fd start + 1
    27  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

即使我确实放入了 FirebaseApp.configure(),我也会在 AppDelegate 中收到此消息:

Thread 1: Exception: "The default FIRApp instance must be configured before the default FIRAuthinstance can be initialized. One way to ensure that is to call `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) in the App Delegate's `application:didFinishLaunchingWithOptions:` (`application(_:didFinishLaunchingWithOptions:)` in Swift)."

任何帮助将不胜感激。我是初学者,很抱歉/如果我没有提供足够的信息,请告诉我。谢谢。

【问题讨论】:

  • 接下来,请包含引发错误的代码;这通常比错误跟踪更重要。最佳实践;添加断点并运行应用程序。如果它工作到该断点,那么该代码可能没问题。然后将断点进一步移动并重试。如果它在断点之前崩溃,请继续备份它,直到您仔细查明崩溃的行并在问题中包含该行和周围的代码。请查看How to create a Minimal, Complete, and Verifiable example

标签: ios swift xcode firebase


【解决方案1】:

必须在调用 Auth API 以创建用户之前配置 Firebase。

FirebaseApp.configure() 应该在应用程序的application:didFinishLaunchingWithOptions: 方法中调用。

请参阅https://firebase.google.com/docs/ios/setup#initialize-firebase 的详细说明。

【讨论】:

    猜你喜欢
    • 2014-12-14
    • 2018-12-11
    • 1970-01-01
    • 2015-09-08
    • 1970-01-01
    • 1970-01-01
    • 2014-10-04
    • 2017-05-25
    • 1970-01-01
    相关资源
    最近更新 更多