gpt4 book ai didi

ios - 应用程序设置 FirebaseMessaging 委托(delegate)时应用程序崩溃

转载 作者:行者123 更新时间:2023-12-02 11:43:39 24 4
gpt4 key购买 nike

我的应用尝试使用 Firebase 远程通知,我遵循了 Firebase 指南。现在,我的应用程序在 AppDelegate 中崩溃,我在其中尝试设置 Firebase 消息传递的委托(delegate)。

这是代码

[FIRApp configure];
[FIRMessaging messaging].delegate = self;

在第二行中,它崩溃并显示崩溃消息,如下所示:

+[FIRInstanceIDCheckinPreferences preferencesFromKeychainContents:]: unrecognized selector sent to class 0x10ef2a538

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[FIRInstanceIDCheckinPreferences preferencesFromKeychainContents:]: unrecognized selector sent to class 0x10ef2a538' * First throw call stack: ( 0 CoreFoundation 0x00000001116671e6 exceptionPreprocess + 294 1 libobjc.A.dylib
0x0000000110cfc031 objc_exception_throw + 48 2 CoreFoundation
0x00000001116e86c4 +[NSObject(NSObject) doesNotRecognizeSelector:] + 132 3 CoreFoundation 0x00000001115e9898 ___forwarding_
+ 1432 4 CoreFoundation 0x00000001115e9278 _CF_forwarding_prep_0 + 120 5 MobilePro Dev
0x000000010ed09af3 -[FIRInstanceIDCheckinStore cachedCheckinPreferences] + 407 6 MobilePro Dev
0x000000010ed0d73a -[FIRInstanceIDStore resetCredentialsIfNeeded] + 145 7 MobilePro Dev 0x000000010ed0d230 -[FIRInstanceIDStore initWithCheckinStore:tokenStore:delegate:] + 174 8 MobilePro Dev 0x000000010ed0d154 -[FIRInstanceIDStore initWithDelegate:] + 142 9 MobilePro Dev 0x000000010ed10acc -[FIRInstanceIDTokenManager init] + 105 10 MobilePro Dev 0x000000010ed022ae -[FIRInstanceID setupTokenManager] + 50 11 MobilePro Dev
0x000000010ed0225c -[FIRInstanceID start] + 90 12 libdispatch.dylib 0x0000000114c4f7ec _dispatch_client_callout + 8 13 libdispatch.dylib 0x0000000114c50d64 dispatch_once_f + 285 14 MobilePro Dev
0x000000010ecfefac +[FIRInstanceID instanceID] + 45 15 MobilePro Dev 0x000000010ed26a6a -[FIRMessaging initPrivately] + 38 16 MobilePro Dev 0x000000010ed26939 25+[FIRMessaging messaging]_block_invoke + 41 17 libdispatch.dylib
0x0000000114c4f7ec _dispatch_client_callout + 8 18 libdispatch.dylib 0x0000000114c50d64 dispatch_once_f + 285 19 MobilePro Dev
0x000000010ed2690d +[FIRMessaging messaging] + 45 20 MobilePro Dev
0x000000010eaa9ac3 -[AppDelegate application:didFinishLaunchingWithOptions:] + 323 21 UIKit
0x00000001128d96fb -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 278 22 UIKit 0x00000001128db172 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4123 23 UIKit 0x00000001128e05cb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1677 24 UIKit 0x0000000112ca2f7e __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866 25 UIKit 0x0000000113075a39 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153 26 UIKit 0x0000000112ca2bba -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236 27 UIKit 0x0000000112ca33db -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675 28 UIKit
0x0000000113614614 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 299 29 UIKit 0x00000001136144ae -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433 30 UIKit 0x00000001132f875d __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221 31 UIKit 0x00000001134f34b7 _performActionsWithDelayForTransitionContext + 100 32 UIKit 0x00000001132f8627 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223 33 UIKit 0x00000001130750e0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392 34 UIKit 0x00000001128deeac -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515 35 UIKit 0x0000000112eb1bcb -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361 36 FrontBoardServices 0x00000001176452f3 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331 37 FrontBoardServices 0x000000011764dcfa __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 225 38 libdispatch.dylib 0x0000000114c4f7ec _dispatch_client_callout + 8 39 libdispatch.dylib 0x0000000114c54db8 _dispatch_block_invoke_direct + 592 40 FrontBoardServices 0x0000000117679470 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK
+ 24 41 FrontBoardServices 0x000000011767912e -[FBSSerialQueue _performNext] + 439 42 FrontBoardServices 0x000000011767968e -[FBSSerialQueue _performNextFromRunLoopSource] + 45 43 CoreFoundation 0x0000000111609bb1 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 44 CoreFoundation 0x00000001115ee4af __CFRunLoopDoSources0 + 271 45 CoreFoundation 0x00000001115eda6f __CFRunLoopRun + 1263 46 CoreFoundation
0x00000001115ed30b CFRunLoopRunSpecific + 635 47 GraphicsServices
0x000000011779ca73 GSEventRunModal + 62 48 UIKit
0x00000001128e2057 UIApplicationMain + 159 49 MobilePro Dev
0x000000010eac56cf main + 111 50 libdyld.dylib
0x0000000114ccc955 start + 1 51 ???
0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

最佳答案

如果您不使用 pod,则必须为您的目标添加 objC 链接器标志。

来自文档:

“无需 CocoaPods 进行集成如果您不想使用 Cocoapods,您仍然可以通过直接导入框架来利用 Firebase SDK。

下载框架 SDK zip。这是一个约 1GB 的文件,下载可能需要一些时间。

解压缩文件,然后查看您要包含在应用中的框架的自述文件。

在目标的build设置中的“其他链接器设置”中添加 ObjC 链接器标志。

链接: https://firebase.google.com/docs/ios/setup https://developer.apple.com/library/archive/qa/qa1490/_index.html

关于ios - 应用程序设置 FirebaseMessaging 委托(delegate)时应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51893630/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com