Nativescript-plugin-firebase: "FIRMessaging is already connected" error on iOS

Created on 16 Dec 2017  路  8Comments  路  Source: EddyVerbruggen/nativescript-plugin-firebase

I get this error log when my app starts. There are some logs I create in the login page. You can see the value of the token in these logs. Notice that onPushTokenReceivedCallback is called twice. In the first one token is a string. In the second one I think it is a native object. Because of that I have to check if type of the token is string in my code.

I get the data message but iPhone doesn't create a device notification when a new message received. This might be the result of another thing I need to fix. I will check it.

CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:2297:20: >> fcmToken refreshed: c2JSwuX3l30:APA91bEiDhkuwJPD6JolbPDYFIf-ghNR-YWQ09vi57WBdT9eZEgw_LEwQ38lYui92XbuKNNK_cBHKbCXDJDzvY_T_svDCxJNhmlFkaW8BuK8ZDfJEJ0yLfNnjCawC875yGn06-yNeib5 CONSOLE LOG file:///app/pages/login/login.component.js:73:28: token is c2JSwuX3l30:APA91bEiDhkuwJPD6JolbPDYFIf-ghNR-YWQ09vi57WBdT9eZEgw_LEwQ38lYui92XbuKNNK_cBHKbCXDJDzvY_T_svDCxJNhmlFkaW8BuK8ZDfJEJ0yLfNnjCawC875yGn06-yNeib5 CONSOLE LOG file:///app/pages/login/login.component.js:75:32: this is string CONSOLE LOG file:///app/pages/login/login.component.js:73:28: token is NSConcreteNotification 0x1c084f060 {name = com.firebase.iid.notif.refresh-token; object = c2JSwuX3l30:APA91bEiDhkuwJPD6JolbPDYFIf-ghNR-YWQ09vi57WBdT9eZEgw_LEwQ38lYui92XbuKNNK_cBHKbCXDJDzvY_T_svDCxJNhmlFkaW8BuK8ZDfJEJ0yLfNnjCawC875yGn06-yNeib5} CONSOLE ERROR file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:569:26: Unhandled Promise rejection: Error Domain=com.google.fcm Code=2001 "FIRMessaging is already connected" UserInfo={NSLocalizedFailureReason=FIRMessaging is already connected} ; Zone: <root> ; Task: null ; Value: Error Domain=com.google.fcm Code=2001 "FIRMessaging is already connected" UserInfo={NSLocalizedFailureReason=FIRMessaging is already connected} undefined CONSOLE ERROR file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:571:22: Error: Uncaught (in promise): Error Domain=com.google.fcm Code=2001 "FIRMessaging is already connected" UserInfo={NSLocalizedFailureReason=FIRMessaging is already connected}

Most helpful comment

Thanks guys, if everything is working and you see this message, it simply means the plugin tries to reconnect when it's already connected - no harm.

All 8 comments

Same issue here

It seems like I forgot to add the APN's auth key to the firebase console cloud messaging settings (firebase console -> yourApp -> Settings -> Cloud Messaging settings).

also make sure to read this guide

Are you sure that this solved the problem? I added it but still get the error message.

@erkanarslan
I was going through a lot in this issue...I will just tell you what I did and see if you didn't do it:

  1. Had to create a paid apple developer for supporting firebase messaging.
  2. Enter to Xcode Preferences -> account -> Enter you paid apple account.
  3. Without adding anything just run "tns run ios", this will create you the Xcode workspace file in the ios platform folder, enter the "yourproject.xcworkspace" file and switch on the "Push Notifications" under "Capabilities" tab... this will create you a platforms/ios/YourAppName/(Resources/)YourAppName.entitlements file, take it and put it in your app/App_Resources/IOS folder.
  4. Allow processing when a background push is received:
    add this value toapp/App_Resources/iOS/Info.plist:
<key>UIBackgroundModes</key>
<array>
  <string>remote-notification</string>
</array>
  1. Make sure do this guide
  2. Make sure the firebase project's app is configured correctly with the right bundle id and upload the APN's Key file that you get from the last guide

Really hope I remembered all the things I did :)

I did all of these already. Push notifications are working but I still get
this message when app starts.

@erkanarslan
For sure the thing that solved it for me is to upload the APN's key file to the firebase ios app configuration

Thanks guys, if everything is working and you see this message, it simply means the plugin tries to reconnect when it's already connected - no harm.

Ya hice todo esto. Las notificaciones push est谩n funcionando, pero a煤n recibo este mensaje cuando se inicia la aplicaci贸n.

maint.ts

require("nativescript-plugin-firebase");

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EddyVerbruggen picture EddyVerbruggen  路  3Comments

NNieto picture NNieto  路  4Comments

phatakrajan picture phatakrajan  路  4Comments

andrewexton373 picture andrewexton373  路  4Comments

vchimev picture vchimev  路  3Comments