Firebase运行时崩溃 - FIRInstanceIDConfig

时间:2017-03-02 16:15:45

标签: ios objective-c firebase firebase-cloud-messaging

我已将Firebase SDK手动添加到我的项目中。 (由于配置问题,无法使用cocoapod。)

我使用以下框架

FirebaseCore.framework        
FirebaseInstanceID.framework
Firebasemessageing.framework

AppDelegate我导入了以下内容:

#import "Firebase.h
#import <FirebaseInstanceID/FirebaseInstanceID.h>
#import <FirebaseMessaging/FirebaseMessaging.h>

如果我参考

[FIRMessaging messaging].remoteMessageDelegate = self;

我遇到以下错误导致运行时崩溃:

控制台中的错误消息:

  

***因未捕获的异常终止应用&#39; NSInvalidArgumentException&#39;,原因:&#39; - [__ NSCFConstantString   fira_UTF32Length]:

但是,如果我注释掉并引用这行代码

 [[FIRInstanceID instanceID] token]

我收到此错误:

  

***由于未捕获的异常终止应用程序&#39; NSInvalidArgumentException&#39;,原因:&#39; - [FIRInstanceIDConfig setAllowGCMRegistrationWithoutAPNSToken:]:无法识别的选择器发送到实例

我添加了我能想到的所有必需框架,但仍然遇到了这个问题。

修改

链接到项目的框架的完整列表:

  • Fabric,
  • FirebaseAnalytics
  • FirebaseCore
  • FirebaseInstanceID
  • FirebaseMessaging
  • GoogleToolboxForMac
  • GTMSessionFetcher
  • 的Protobuf
  • FirebaseAppIndexing
  • 的WebKit
  • LocalAuthentication
  • 安全
  • 的ImageIO
  • 素材资源库
  • CoreData
  • 的UIKit
  • 的libc ++。TBD
  • libsqlite3.tbd
  • libGoogleAnalyticsServices.a
  • libAdIdAccess.a程式

堆栈跟踪:

崩溃的主线是:

    0   ???                                 0x00000001057f0a44 0x0 + 4387179076,
1   MyApp                            0x000000010050f220 main + 0,
2   libsystem_c.dylib                   0x0000000181363400 abort + 140,
3   libc++abi.dylib                     0x0000000180e2d2d4 __cxa_bad_cast + 0,
4   libc++abi.dylib                     0x0000000180e4acc0 <redacted> + 0,
5   libobjc.A.dylib                     0x0000000180e58844 <redacted> + 124,
6   libc++abi.dylib                     0x0000000180e4766c <redacted> + 16,
7   libc++abi.dylib                     0x0000000180e476dc _ZSt9terminatev + 64,
8   libobjc.A.dylib                     0x0000000180e587a0 <redacted> + 0,
9   libdispatch.dylib                   0x00000001015bd22c _dispatch_client_callout + 36,
10  libdispatch.dylib                   0x00000001015be048 dispatch_once_f + 116,
11  MyApp                            0x00000001006484d4 +[FIRInstanceID instanceID] + 56,
12  MyApp                            0x00000001000fa880 -[BBAppDelegate connectToFcm] + 52,
13  MyApp                            0x00000001000f3ac8 -[BBAppDelegate applicationDidBecomeActive:] + 356,
14  UIKit                               0x000000018835b4c0 <redacted> + 1152,
15  UIKit                               0x000000018855ec48 <redacted> + 2744,
16  UIKit                               0x0000000188573104 <redacted> + 48,
17  UIKit                               0x000000018855b7ec <redacted> + 168,
18  FrontBoardServices                  0x0000000183ff792c <redacted> + 36,
19  FrontBoardServices                  0x0000000183ff7798 <redacted> + 176,
20  FrontBoardServices                  0x0000000183ff7b40 <redacted> + 56,
21  CoreFoundation                      0x00000001823ceb5c <redacted> + 24,
22  CoreFoundation                      0x00000001823ce4a4 <redacted> + 524,
23  CoreFoundation                      0x00000001823cc0a4 <redacted> + 804,
24  CoreFoundation                      0x00000001822fa2b8 CFRunLoopRunSpecific + 444,
25  UIKit                               0x00000001883417b0 <redacted> + 608,
26  UIKit                               0x000000018833c534 UIApplicationMain + 208,
27  MyApp                            0x000000010050f2c4 main + 164,
28  libdyld.dylib                       0x00000001812dd5b8 <redacted> + 4
)

1 个答案:

答案 0 :(得分:11)

项目中转到构建设置 - &gt;双击其他链接标记 - &gt;单击底部的加号( + )按钮添加-ObjC,然后按Enter键。希望它能解决你的问题。