Paul Stein Paul Stein - 29 days ago 6
iOS Question

[FIRA_AppDelegate- messaging:didRefreshRegistrationToken:]: unrecognized selector sent to instance - firebase crash issue

I found a new issue when I reinstalled the iOS app. Before reinstalling the app worked fine. Before reinstalling I updated cocoa sdk repo and it updated Firebase and FirebaseDatabase version from 3.15.0 to version 4.0.0.

Here is the crash log below:


-[FIRA_AppDelegate-1495465837867 messaging:didRefreshRegistrationToken:]: unrecognized selector sent to
instance 0x174661b40 2017-05-22 23:10:58.550969+0800
moodfriends[1716:245390] *** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason:
'-[FIRA_AppDelegate-1495465837867
messaging:didRefreshRegistrationToken:]: unrecognized selector sent to
instance 0x174661b40'

Answer Source

Just found the solution.

Changed

[FIRMessaging messaging].remoteMessageDelegate = self;

to

[FIRMessaging messaging].delegate = self;

It seems remoteMessageDelegate is deprecated with the version update and should FIRMessagingDelegate delegate functions.

Swift 3:

Messaging.messaging().delegate = self