Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase runtime crash - FIRInstanceIDConfig

I have added the Firebase SDK manually to my project. (Can't use cocoapods due to configuration issues.)

I use the following frameworks

FirebaseCore.framework        
FirebaseInstanceID.framework
Firebasemessageing.framework

In the AppDelegate I have imported the following:

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

If I make reference to

[FIRMessaging messaging].remoteMessageDelegate = self;

I get a runtime crash with the following error:

Error message in the console:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString fira_UTF32Length]:

However if I comment out that and make reference to this line of code

 [[FIRInstanceID instanceID] token]

I get this error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FIRInstanceIDConfig setAllowGCMRegistrationWithoutAPNSToken:]: unrecognized selector sent to instance

I have added all the required frameworks I can think of, yet still getting this issue.

Edit

The complete list of Frameworks linked to the project:

  • Fabric,
  • FirebaseAnalytics
  • FirebaseCore
  • FirebaseInstanceID
  • FirebaseMessaging
  • GoogleToolboxForMac
  • GTMSessionFetcher
  • Protobuf
  • FirebaseAppIndexing
  • WebKit
  • LocalAuthentication
  • Security
  • ImageIO
  • AssetLibrary
  • CoreData
  • UIKit
  • libc++.tbd
  • libsqlite3.tbd
  • libGoogleAnalyticsServices.a
  • libAdidAccess.a

The stack trace:

This is the thread where it crashes is:

    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
)
like image 821
Robert J. Clegg Avatar asked Mar 02 '17 16:03

Robert J. Clegg


1 Answers

In project Go to Build Setting -> Double click on Other Linker Flags ->click the plus(+)button from bottom add -ObjC and press enter. Hope it would solve your problem.

like image 136
Gurjinder Singh Avatar answered Oct 18 '22 19:10

Gurjinder Singh