Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Firebase was unable to connect to FCM #105

Closed
kamranarshad opened this issue Aug 15, 2016 · 59 comments
Closed

Firebase was unable to connect to FCM #105

kamranarshad opened this issue Aug 15, 2016 · 59 comments

Comments

@kamranarshad
Copy link

Getting the following error when running FCM on iOS, but works fine in android.

CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:347:14: Firebase FCM token received: fcCwcTew2Po:APA91bGjgIRM2Wqkw2uZH273AGvGT1-j2fZdjHz7aKGtzDqFB19W9VQYxwLzcPSnliF6zsGsixZ5xxGAkQvX4bwXoE9xM63wuKY_z9DZGbfNMs_UWer4kuCd36Re3X9SG8WU4-umr-3I Aug 15 17:21:09 Kamrans-MacBook-Pro Messaging[8276]: CONSOLE LOG file:///app/pages/home/home.js:20:20: Firebase push token: fcCwcTew2Po:APA91bGjgIRM2Wqkw2uZH273AGvGT1-j2fZdjHz7aKGtzDqFB19W9VQYxwLzcPSnliF6zsGsixZ5xxGAkQvX4bwXoE9xM63wuKY_z9DZGbfNMs_UWer4kuCd36Re3X9SG8WU4-umr-3I Aug 15 17:21:09 Kamrans-MacBook-Pro Messaging[8276]: CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:356:18: Firebase was unable to connect to FCM. Error: Error Domain=com.google.fcm Code=501 "(null)"

@EddyVerbruggen
Copy link
Owner

I've added a comment at the line that logs the error: "// this is not fatal at all but still would like to know how often this happens". So can you try to see if it still works correctly? I can see you've received a push token..

@kamranarshad
Copy link
Author

kamranarshad commented Aug 15, 2016

It stills don't seem to work for iOS but only for works for Android. Plus I don't get the notification prompt. I have deleted the node_modules and platform folders and started again. Still the same problem.

I have tried sending a push notification from firebase and it doesn't seem to work.

@EddyVerbruggen
Copy link
Owner

Did you do this and this exactly as documented?

@kamranarshad
Copy link
Author

Yes, I have.

Plus there is a step missing after you uncommenting Firebase/Messaging in the podfile. You have to go into you iOS platform folder and run pod install

@EddyVerbruggen
Copy link
Owner

That's supposed to happen automatically when doing a tns run ios, no? Anyway, I always remove and add my platform folder after such a significant change.

What's your testdevice?

@kamranarshad
Copy link
Author

nexus 6p for android and simulator for ios

@EddyVerbruggen
Copy link
Owner

You know you can't receive notifications on the iOS sim, right?

You should be able to receive the "this app wants to send push notifications" prompt but that's all down to the provisioning profile stuff.

@kamranarshad
Copy link
Author

I don't even see

"this app wants to send push notifications"

@EddyVerbruggen
Copy link
Owner

Try a real device first. You can't receive notifications on the simulator anyway.

@kamranarshad
Copy link
Author

How come I don't get the prompt for notification support for iOS simulator.

@EddyVerbruggen
Copy link
Owner

IDK. Just try a real device with the proper push entitlement settings etc and let me know how that works out for you.

@dbenninger
Copy link
Contributor

I have got the same issue with a real device.

@EddyVerbruggen
Copy link
Owner

Taking a look.

@EddyVerbruggen
Copy link
Owner

Added a section to the messaging readme on this topic.

If you still don't see a prompt I will need to look at your code because I just retested this on a fresh app with success..

@dbenninger
Copy link
Contributor

I have created a new nativescript 2.2.0 app with the same app id and I still get the same issue:

2016-08-17 10:29:33.894 FirebaseTest[2246:1488909] Configuring the default app.
2016-08-17 10:29:33.906 FirebaseTest[2246:] <FIRAnalytics/INFO> Firebase Analytics v.3201000 started
2016-08-17 10:29:33.907 FirebaseTest[2246:] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu)
2016-08-17 10:29:33.913 FirebaseTest[2246:1488909] Firebase Crash Reporting: Successfully enabled
2016-08-17 10:29:33.921: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
2016-08-17 10:29:33.921: <FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "(null)"
2016-08-17 10:29:33.925: <FIRMessaging/INFO> FIRMessaging library version 1.1.0
2016-08-17 10:29:33.967: <FIRMessaging/WARNING> FIRMessaging AppDelegate proxy enabled, will swizzle app delegate remote notification receiver handlers. Add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
CONSOLE LOG file:///app/main.js:7:16: firebase.init done
NativeScript loaded bundle file:///System/Library/Frameworks/CoreGraphics.framework
NativeScript loaded bundle file:///var/containers/Bundle/Application/CC5C03CF-F880-4222-8043-6721FF034197/FirebaseTest.app/Frameworks/TNSWidgets.framework
CONSOLE LOG file:///app/tns_modules/@angular/core/src/facade/lang.js:360:16: Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
2016-08-17 10:29:34.937 FirebaseTest[2246:] <FIRAnalytics/INFO> Firebase Analytics enabled
CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:347:14: Firebase FCM token received: fezdZIu3NMw:APA91bEivcLKSgKM-VK616-kZ5IrBVvk5xMaoGMgvyJsUsPib7aX1wU5DZOi0AmG0Giya5ZK6HFAEhbfLwvyYZIosEa_XXEhmYSAnfr6IbmVq0Op2to63Aeg_AnIUM191dBJMxCjmvaH
CONSOLE LOG file:///app/main.js:12:16: token is: fezdZIu3NMw:APA91bEivcLKSgKM-VK616-kZ5IrBVvk5xMaoGMgvyJsUsPib7aX1wU5DZOi0AmG0Giya5ZK6HFAEhbfLwvyYZIosEa_XXEhmYSAnfr6IbmVq0Op2to63Aeg_AnIUM191dBJMxCjmvaH
2016-08-17 10:29:35.384: <FIRMessaging/WARNING> FIRMessaging registration is not ready with auth credentials
CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:356:18: Firebase was unable to connect to FCM. Error: Error Domain=com.google.fcm Code=501 "(null)"

Do you have any ideas what I might have done wrong?

@EddyVerbruggen
Copy link
Owner

Like I said I need to take a look at the code, otherwise it's impossible for me to assist.

@dbenninger
Copy link
Contributor

Sample project for iOS only (because Android works fine). Please note that I have removed the GoogleService-Info.plist and changed the app id...

FirebaseTest.zip

@EddyVerbruggen
Copy link
Owner

Thanks! Taking a look..

@EddyVerbruggen
Copy link
Owner

@dbenninger You're doing it right, and with your app I was able to get this prompt in the simulator:

simulator screen shot 17 aug 2016 12 03 16

What I did after unzipping you code was:

  • Added my own GoogleService-Info.plist to app/App_Resources/iOS
  • Change the nativescript.id in the root package.json to org.nativescript.firebasedemo (same as the BUNDLE_ID in GoogleService-Info.plist
  • Added console.log("------ firebase bootstrap ok"); to node_modules/nativescript-plugin-firebase/firebase.ios.js at line 140, so inside the function where UIApplicationDidFinishLaunchingNotification is registered
  • Confirmed the log statement was logged when the app started
  • tns platform remove ios && tns platform add ios to clear any dangling stuff

Upon the next `tns emulate ios --device "iPhone 6s" I got that prompt.

Let me know if you can at least get the console.log statement to show up as that's key to showing the prompt (actually the line application.registerForRemoteNotifications(); in said funtion is).

@dbenninger
Copy link
Contributor

Well, I always got the prompt, even with the error messages in the log.

I followed your steps above and this is what I got in the simulator:
Aug 17 13:11:48 Davids-MacBook-Pro-2 FirebaseTest[60987]: Configuring the default app.
Aug 17 13:11:48 Davids-MacBook-Pro-2 FirebaseTest[60987]: Normal message received by listener connection. Ignoring.
Aug 17 13:11:48 Davids-MacBook-Pro-2 FirebaseTest[60987]: Could not successfully update network info during initialization.
Aug 17 13:11:48 Davids-MacBook-Pro-2 FirebaseTest[60987]: Firebase Crash Reporting: Successfully enabled
Aug 17 13:11:48 Davids-MacBook-Pro-2 FirebaseTest[60987]: <FIRAnalytics/INFO> Firebase Analytics v.3201000 started
Aug 17 13:11:48 Davids-MacBook-Pro-2 FirebaseTest[60987]: <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu)
Aug 17 13:11:48 Davids-MacBook-Pro-2 FirebaseTest[60987]: CONSOLE LOG file:///app/main.js:7:16: firebase.init done
Aug 17 13:11:48 Davids-MacBook-Pro-2 backboardd[60928]: SecTaskCopyDebugDescription: FirebaseTest[60987]
Aug 17 13:11:48 Davids-MacBook-Pro-2 backboardd[60928]: SecTaskCopyDebugDescription: FirebaseTest[60987]
Aug 17 13:11:48 Davids-MacBook-Pro-2 backboardd[60928]: SecTaskCopyDebugDescription: FirebaseTest[60987]
Aug 17 13:11:49 Davids-MacBook-Pro-2 backboardd[60928]: SecTaskCopyDebugDescription: FirebaseTest[60987]
Aug 17 13:11:49 Davids-MacBook-Pro-2 backboardd[60928]: SecTaskCopyDebugDescription: FirebaseTest[60987]
Aug 17 13:11:49 Davids-MacBook-Pro-2 FirebaseTest[60987]: assertion failed: 15G31 13E230: libxpc.dylib + 57882 [66C28065-C9DB-3C8E-926F-5A40210A6D1B]: 0x7d
Aug 17 13:11:49 Davids-MacBook-Pro-2 FirebaseTest[60987]: CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:140:18: ------ firebase bootstrap ok
Aug 17 13:11:49 Davids-MacBook-Pro-2 FirebaseTest[60987]: <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
Aug 17 13:11:49 --- last message repeated 1 time ---
Aug 17 13:11:49 Davids-MacBook-Pro-2 FirebaseTest[60987]: CONSOLE LOG file:///app/tns_modules/@angular/core/src/facade/lang.js:360:16: Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
Aug 17 13:11:49 --- last message repeated 3 times ---
Aug 17 13:11:49 Davids-MacBook-Pro-2 FirebaseTest[60987]: (Error) MC: MobileContainerManager gave us a path we weren't expecting; file a radar against them
Expected: /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
Actual: /Users/davidbenninger/Library/Developer/CoreSimulator/Devices/9AF1BF74-AAA6-4CF4-B4D3-10D54627EF1C/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
Overriding MCM with the one true path
Aug 17 13:11:49 Davids-MacBook-Pro-2 FirebaseTest[60987]: CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:348:14: Firebase FCM token received: cE-kjBcBIHs:APA91bGTTcABSdKPd-f9miZFPJDTN38c3amYYTwS80I4nAIKtc1mzhVpOgWHlm4kar8KQ7Sa7gOIqAx5U5p3rOlrDORPIRUUutgnrJUS29TTln6UdUPIkqEnYiZm_EYkpJ-cblbjX7RF
Aug 17 13:11:49 Davids-MacBook-Pro-2 FirebaseTest[60987]: CONSOLE LOG file:///app/main.js:12:16: token is: cE-kjBcBIHs:APA91bGTTcABSdKPd-f9miZFPJDTN38c3amYYTwS80I4nAIKtc1mzhVpOgWHlm4kar8KQ7Sa7gOIqAx5U5p3rOlrDORPIRUUutgnrJUS29TTln6UdUPIkqEnYiZm_EYkpJ-cblbjX7RF
Aug 17 13:11:49 Davids-MacBook-Pro-2 FirebaseTest[60987]: CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:357:18: Firebase was unable to connect to FCM. Error: Error Domain=com.google.fcm Code=501 "(null)"
Aug 17 13:11:49 Davids-MacBook-Pro-2 FirebaseTest[60987]: <FIRAnalytics/INFO> Firebase Analytics enabled

And this is what I get on my device:
2016-08-17 13:14:05.818 FirebaseTest[2300:1518213] Configuring the default app.
2016-08-17 13:14:05.830 FirebaseTest[2300:] <FIRAnalytics/INFO> Firebase Analytics v.3201000 started
2016-08-17 13:14:05.836 FirebaseTest[2300:] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu)
2016-08-17 13:14:05.838 FirebaseTest[2300:1518213] Firebase Crash Reporting: Successfully enabled
2016-08-17 13:14:05.848: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
2016-08-17 13:14:05.848: <FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "(null)"
2016-08-17 13:14:05.855: <FIRMessaging/INFO> FIRMessaging library version 1.1.0
2016-08-17 13:14:05.893: <FIRMessaging/WARNING> FIRMessaging AppDelegate proxy enabled, will swizzle app delegate remote notification receiver handlers. Add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
CONSOLE LOG file:///app/main.js:7:16: firebase.init done
CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:140:18: ------ firebase bootstrap ok
NativeScript loaded bundle file:///System/Library/Frameworks/CoreGraphics.framework
NativeScript loaded bundle file:///var/containers/Bundle/Application/42FE4599-B4E2-4E61-BDC9-218D0A2FBA6B/FirebaseTest.app/Frameworks/TNSWidgets.framework
CONSOLE LOG file:///app/tns_modules/@angular/core/src/facade/lang.js:360:16: Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
2016-08-17 13:14:07.163 FirebaseTest[2300:] <FIRAnalytics/INFO> Firebase Analytics enabled
CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:348:14: Firebase FCM token received: evO9xQDZnpk:APA91bEKKLGOdZJbLHt5r_bO69p0Ve4dnsEqiOcxj8aA1Og_ijPnYTlGTt498cyKfGvctspLHVmv_wNbZqVAdvjmfGPJaf3ottUeK8LaxOj-LBfRBePn4w0KLFlYYrZlasyoB6S__RfO
CONSOLE LOG file:///app/main.js:12:16: token is: evO9xQDZnpk:APA91bEKKLGOdZJbLHt5r_bO69p0Ve4dnsEqiOcxj8aA1Og_ijPnYTlGTt498cyKfGvctspLHVmv_wNbZqVAdvjmfGPJaf3ottUeK8LaxOj-LBfRBePn4w0KLFlYYrZlasyoB6S__RfO
2016-08-17 13:14:07.636: <FIRMessaging/WARNING> FIRMessaging registration is not ready with auth credentials
CONSOLE LOG file:///app/tns_modules/nativescript-plugin-firebase/firebase.js:357:18: Firebase was unable to connect to FCM. Error: Error Domain=com.google.fcm Code=501 "(null)"

@EddyVerbruggen
Copy link
Owner

@dbenninger So @kamranarshad said he didn't get the prompt and you said "I have got the same issue with a real device." so I assumed you didn't see it as well.

So what exactly is and is not working for you and what have you tried? If I Google for "FIRMessaging registration is not ready with auth credentials" (part of the log above) I see people saying you need to upload your APNS certificates to Firebase. Did you do that for your app in the Fb console at settings > Cloud messaging?

@dbenninger
Copy link
Contributor

Yes, sorry about that, I was only referring to the "Firebase was unable to connect to FCM" log message. The problem is that I do not get any push notifications on iOS.

I did create the certificates and uploaded them to Firebase. But I think I'll just delete the Firebase project completely and start over again... something must be messed up. I will let you know if I find the issue...

@EddyVerbruggen
Copy link
Owner

OK, good luck. I think you're on the right track. Make sure the app id's in package.json, the plist, etc are all the same.

@dbenninger
Copy link
Contributor

Thanks. Quick question: when running on your simulator, did you get any errors or warnings in the console? Did you try it on a real device?

@EddyVerbruggen
Copy link
Owner

I probably got warnings but don't mind them since I always test on a real device as well as a sim can't receive notifications.

@Sethiatspace
Copy link

Sethiatspace commented Aug 19, 2016

I can't get it to work either. What a f*****g pain in the ass it is to make it work on iOS whereas it works so effortlessly on Android.
I tried everything under the sun, I followed each guide, uploaded the p12, re-downloaded provisioning profile, used Xcode to deploy to make sure I was using the right signing identity, etc but I always get this stupid message.

I have looked around extensively on the internet to find a solution but without much success. I found two possible solutions, could you have a look?
googlesamples/google-services#205 (comment)
"501 means that the app is missing an id that GCM needs requires. (...) If you guys are facing issues with this I would suggest moving to the new Firebase Cloud Messaging libraries. We don't expose these errors in the new library and we all the auto-retry and fetch stuff is in it so you wouldn't have to worry about these errors."

And
https://codedump.io/share/Co9IremtXwOv/1/cloud-messaging-handing-terminate-app
"After that in App Delegate use the code below(I specify the tricky line) : (...)"
"FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.Unknown)"

Also, maybe this:
"We found the fix - if you enable detailed debug logging you will probably see a message saying something about using the instance id too soon. Once you make the call to the IID api you have wait for a bit before starting to use it to register with GCM. We put in a retry loop with some delay upfront and the problem was gone."

Thank you

@EddyVerbruggen
Copy link
Owner

So guys, how are you testing sending a push notification? I have limited success with the Firebase console, but the curl command is very quick and always delivers push notifications to me.

curl -X POST --header "Authorization: key=SERVER_KEY" --Header "Content-Type: application/json" https://fcm.googleapis.com/fcm/send -d "{\"notification\":{\"title\": \"My title\", \"text\": \"My text\", \"sound\": \"default\"}, \"priority\": \"High\", \"to\": \"PUSH_TOKEN\"}"
  • The SERVER_KEY is found at the Firebase console, settings (the cog at the top left), cloud messaging. Copy the 40-ish character 'Server key'.
  • To get the PUSH_TOKEN remove and deploy your app, that should give you the "Allow.." prompt. Run init and you should see "Firebase FCM token received" along with the value.

Please let me know if that changes things.

@Sethiatspace
Copy link

Sethiatspace commented Aug 19, 2016

I test directly from the gcm interface and use "send to all". It worked flawlessly for Android so the problem is not from this side I believe but I will test with curl.

@Sethiatspace
Copy link

Nope, absolutely nothing with curl. I even deleted the app to get another token.

@lowe0292
Copy link

Close it! Close it! 🍷

@1Reinier
Copy link

So what was the final fix for this issue?
On Firebase 3.10 I have this issue on first launch of my iOS app, which disappears after 2nd launch.
(Unable to connect to Firebase with error: Error Domain=com.google.fcm Code=501 "(null)")

@xhidnoda
Copy link

yep...this issue just disappear after 2nd lauch.

@wickstargazer
Copy link

Hi, does the library works with XCode 7

@EddyVerbruggen
Copy link
Owner

@wickstargazer dunno, why would you use 7 anyway?

@wickstargazer
Copy link

wickstargazer commented Feb 2, 2017 via email

@EddyVerbruggen
Copy link
Owner

I don't have 7 so you're best equipped to answer your own question I guess.

@wickstargazer
Copy link

wickstargazer commented Feb 2, 2017 via email

@EddyVerbruggen
Copy link
Owner

I meant your initial Q: "Hi, does the library works with XCode 7".

@pap5508
Copy link

pap5508 commented Feb 8, 2017

firebase.init({ // Optionally pass in properties for database, authentication and cloud messaging, // see their respective docs. iOSEmulatorFlush: true, persist: true, onPushTokenReceivedCallback: function(token){ console.log(token+ " Push Token"); setString("deviceToken", token); } }).then( (instance) => { console.log("firebase.init done"); }, (error) => { console.log("firebase.init error: " + error); } );

Getting Log Error :
2017-02-07 14:29:41.138: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
CONSOLE LOG file:///app/app.module.js:22:16: firebase.init done
2017-02-07 14:29:41.246 PushDemo[672:] <FIRAnalytics/INFO> Firebase Analytics v.3600000 started
2017-02-07 14:29:41.249 PushDemo[672:] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu)
2017-02-07 14:29:41.250 PushDemo[672:] <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
2017-02-07 14:29:42.196 PushDemo[672] [Firebase/Core][I-COR000019] Clearcut post completed.
2017-02-07 14:29:43.622 PushDemo[672:] <FIRAnalytics/INFO> Firebase Analytics enabled
14:29:44 - Compilation complete. Watching for file changes.

Also not asking Permission Dialog to receive notification Anyone Face this issue..???

@EddyVerbruggen
Copy link
Owner

Share your project with me plz so I can take a look. Not a fragment, the entire thing.

@pap5508
Copy link

pap5508 commented Feb 8, 2017

@EddyVerbruggen : thank you for your prompt response...
Sorry I asked my Senior won't allow me to share my entire project. But giving you the Class Details.

// this import should be first in order to load some required settings (like globals and reflect-metadata)
import { platformNativeScriptDynamic, NativeScriptModule } from "nativescript-angular/platform";
import { AppModule } from "./app.module";

import firebase = require("nativescript-plugin-firebase");

firebase.init({
    // Optionally pass in properties for database, authentication and cloud messaging,
    // see their respective docs.
}).then(
    (instance) => {
        console.log("firebase.init done");
    },
    (error) => {
        console.log("firebase.init error: " + error);
    }
);

firebase.addOnPushTokenReceivedCallback(
    function(token) {
        console.log('token is: ' + token);
    }
);

platformNativeScriptDynamic().bootstrapModule(AppModule);

This is the main Module where I am initialize the Firebase...

Error In the Xcode...

CONSOLE ERROR file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:342:26: Unhandled Promise rejection: Enable FIRMessaging in Podfile first ; Zone: <root> ; Task: null ; Value: Enable FIRMessaging in Podfile first undefined
CONSOLE ERROR file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:342:26: Unhandled Promise rejection: Enable FIRMessaging in Podfile first ; Zone: <root> ; Task: null ; Value: Enable FIRMessaging in Podfile first undefined
2017-02-08 10:27:27.989406 Hieber[1406:169763] CONSOLE ERROR file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:344:22: Error: Uncaught (in promise): Enable FIRMessaging in Podfile first
CONSOLE ERROR file:///app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:344:22: Error: Uncaught (in promise): Enable FIRMessaging in Podfile first
2017-02-08 10:27:31.491037 Hieber[1406:169763] CONSOLE LOG file:///app/tns_modules/@angular/core/bundles/core.umd.js:78:20: Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
CONSOLE LOG file:///app/tns_modules/@angular/core/bundles/core.umd.js:78:20: Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
2017-02-08 10:27:32.450194 Hieber[1406:169985] [Firebase/Core][I-COR000001] Configuring the default app.
2017-02-08 10:27:32.450 Hieber[1406] <Debug> [Firebase/Core][I-COR000001] Configuring the default app.
2017-02-08 10:27:32.647: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
2017-02-08 10:27:32.665529 Hieber[1406:169763] CONSOLE LOG file:///app/main.js:7:16: firebase.init done
CONSOLE LOG file:///app/main.js:7:16: firebase.init done
2017-02-08 10:27:32.697673 Hieber[1406:169985] <FIRAnalytics/INFO> Firebase Analytics v.3600000 started
2017-02-08 10:27:32.698 Hieber[1406:] <FIRAnalytics/INFO> Firebase Analytics v.3600000 started
2017-02-08 10:27:32.699056 Hieber[1406:169985] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu)
2017-02-08 10:27:32.699 Hieber[1406:] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu)
2017-02-08 10:27:32.704963 Hieber[1406:170051] <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
2017-02-08 10:27:32.707 Hieber[1406:] <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist

@EddyVerbruggen
Copy link
Owner

Don't do addOnPushTokenReceivedCallback before init is done. You can simply add it to init as shown here.

But the main problem is this error log message: Enable FIRMessaging in Podfile first

@pap5508
Copy link

pap5508 commented Feb 8, 2017

@EddyVerbruggen : I have tried that too still getting the same Error.. !!!

@EddyVerbruggen
Copy link
Owner

Great. That's why I need to look at your project. But until then, trial and error continues.

Remove and re-add the ios platform forlder tns platform remove ios.. and check that you have enabled messaging in the firebase json configuration file.

@pap5508
Copy link

pap5508 commented Feb 8, 2017

@EddyVerbruggen : I have remove and re-add iOS Platform still not getting Push Token in console as well as no Permission Dialog for Receive notification

Analytics/INFO> Firebase Analytics v.3600000 started <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu) <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist [] nw_host_stats_add_src recv too small, received 24, expected 28 Feb 8 11:08:31 --- last message repeated 13 times --- [] ____nwlog_simulate_crash_inner_block_invoke dlopen CrashReporterSupport failed [] __nwlog_err_simulate_crash simulate crash failed "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available" CONSOLE LOG file:///app/main.ts:null:null: firebase.init done

@EddyVerbruggen
Copy link
Owner

Do you still have the Enable FIRMessaging in Podfile first message as well?

Like I said: I need your project, otherwise this will go back and forth forever. If you can't send that, then provide me with a new project that reproduces the error.

@pap5508
Copy link

pap5508 commented Feb 8, 2017

@EddyVerbruggen : give me 30 min. creating new project that produces the same error.. and share with you

@pap5508
Copy link

pap5508 commented Feb 8, 2017

PushDemo.zip

@EddyVerbruggen : Pls Check Demo to help me out from this issue...

I have set up...

  1. Certificate in Developer.
  2. Provisioning Profile
  3. Added APN certificate in Firebase

Running app pushDemo.xcworkspace getting following error....
2017-02-08 11:42:08.960256 PushDemo[223:7330] <FIRAnalytics/INFO> Firebase Analytics v.3600000 started 2017-02-08 11:42:08.961 PushDemo[223:] <FIRAnalytics/INFO> Firebase Analytics v.3600000 started 2017-02-08 11:42:09.000: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO 2017-02-08 11:42:09.018461 PushDemo[223:7065] CONSOLE LOG file:///app/firebase.js:15:20: CONSOLE LOG file:///app/firebase.js:15:20: 2017-02-08 11:42:09.019137 PushDemo[223:7065] CONSOLE LOG file:///app/firebase.js:16:20: firebase.init done CONSOLE LOG file:///app/firebase.js:16:20: firebase.init done 2017-02-08 11:42:09.162753 PushDemo[223:7330] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu) 2017-02-08 11:42:09.163 PushDemo[223:] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu) 2017-02-08 11:42:09.167931 PushDemo[223:7330] <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist 2017-02-08 11:42:09.168 PushDemo[223:] <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist

So far no error for FIRMessaging but not getting Push Token...

@pap5508
Copy link

pap5508 commented Feb 9, 2017

@dbenninger : I am facing the same problem.. Please help me out to solve the issue..

@dbenninger
Copy link
Contributor

@pap5508, I would like to help you, but the uploaded PushDemo.zip is missing some important files (e.g. package.json). Could you please share the complete PushDemo project?

Also I think it's weird that FIRMessaging is not logging anything. Did you run 'npm run setup' in the node_modules/nativescript-plugin-firebase folder?

@pap5508
Copy link

pap5508 commented Mar 1, 2017

@dbenninger : thank you.. but I have solved the issue and working fine

@lowe0292
Copy link

lowe0292 commented Mar 1, 2017

@pap5508 don't leave us hanging! What was the fix?

@wddwycc
Copy link

wddwycc commented Mar 27, 2017

Same issue here:

FIRMessaging.messaging().connect { (error) in
  if (error != nil) {
    print("Unable to connect with FCM. \(error)")
  } else {
    print("Connected to FCM.")
  }
}

Error

Unable to connect with FCM. Optional(Error Domain=com.google.fcm Code=501 "(null)")

@KissMoon36
Copy link

Hello.. Can anyone help me with fcm from my cell phone? I don't know what to do with it.. Are they normal values or do I have a spy there? Every article on the net says different Thanks
Screenshot_2021-09-07-19-26-27-291_com google android gms
IMG_20210907_140858
Screenshot_2021-09-07-14-11-46-314_com google android gms
IMG_20210907_140736

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests