Running the FCM demo app on my iPhone doesn't work - The Firebase ID is nil.
Steps to reproduce:
pod try Firebase
, and run 10: quickstart-ios/messaging/FCM.xcodeproj
GoogleService-Info.plist
file into the projectMy Mac has the appropriate certificates to develop and deploy apps:
I see lots of noise in the logs, but the most significant error is this one:
Failed to fetch default token Error Domain=com.firebase.iid Code=0 "(null)"
Here is the full console output:
2016-06-25 16:15:08.339 FCM[7398:4128979] Configuring the default app.
2016-06-25 16:15:08.383 FCM[7398:] <FIRAnalytics/INFO> Firebase Analytics v.3200000 started
2016-06-25 16:15:08.396: <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-06-25 16:15:08.397: <FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "(null)"
2016-06-25 16:15:08.403: <FIRMessaging/INFO> FIRMessaging library version 1.1.0
2016-06-25 16:15:08.413: <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
2016-06-25 16:15:08.443 FCM[7398:] <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
2016-06-25 16:15:08.508 FCM[7398:] <FIRAnalytics/INFO> Firebase Analytics enabled
2016-06-25 16:15:08.538: <FIRInstanceID/WARNING> APNS Environment in profile: development
2016-06-25 16:15:08.848 FCM[7398:4128979] Connected to FCM.
2016-06-25 16:15:08.893: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=0 "(null)"
2016-06-25 16:15:22.311: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=0 "(null)"
2016-06-25 16:15:36.774 FCM[7398:4128979] Unable to connect to FCM. Error Domain=com.google.fcm Code=2001 "(null)"
2016-06-25 16:15:40.552 FCM[7398:4128979] Subscribed to news topic
2016-06-25 16:15:43.100 FCM[7398:4128979] InstanceID token: (null)
2016-06-25 16:15:49.036: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=0 "(null)"
2016-06-25 16:16:31.022: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=0 "(null)"
2016-06-25 16:17:32.976: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=0 "(null)"
2016-06-25 16:17:32.976: <FIRInstanceID/WARNING> Failed to retrieve the default GCM token after 5 retries
2016-06-25 16:19:10.662 FCM[7398:4128979] InstanceID token: (null)
2016-06-25 16:19:10.980: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=0 "(null)"
2016-06-25 16:19:10.981: <FIRInstanceID/WARNING> Failed to retrieve the default GCM token after 5 retries
Try updating Firebase/Core to v3.4.4, it fixed unexpected errors for me. Otherwise the typical fixes are:
Push Notifications
under the app's Capabilities
unregisterForRemoteNotifications
. After this call, you can't register the device anymore to push notifications.FirebaseAppDelegateProxyEnabled
to NO
in your info.plist file. I think there are bugs with their method swizzling.[[FIRMessaging messaging] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeUnknown]
in the method didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
I just ran the same code on the simulator (iPhone 5, iOS 9.3), and I get a token without any trouble.
I do see lots of the same warnings, though...
2016-06-25 16:38:31.353 FCM[2546:42455] Configuring the default app.
2016-06-25 16:38:32.561 FCM[2546:] <FIRAnalytics/INFO> Firebase Analytics v.3200000 started
2016-06-25 16:38:32.833 FCM[2546:] <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
2016-06-25 16:38:32.901: <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-06-25 16:38:32.928: <FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "(null)"
2016-06-25 16:38:32.971: <FIRMessaging/INFO> FIRMessaging library version 1.1.0
2016-06-25 16:38:33.189: <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
2016-06-25 16:38:51.094: <FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=NSCocoaErrorDomain Code=3010 "REMOTE_NOTIFICATION_SIMULATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION" UserInfo={NSLocalizedDescription=REMOTE_NOTIFICATION_SIMULATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION}
2016-06-25 16:38:51.096: <FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=NSCocoaErrorDomain Code=3010 "REMOTE_NOTIFICATION_SIMULATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION" UserInfo={NSLocalizedDescription=REMOTE_NOTIFICATION_SIMULATOR_NOT_SUPPORTED_NSERROR_DESCRIPTION}
2016-06-25 16:38:51.140 FCM[2546:42883] CFNetwork SSLHandshake failed (-9806)
2016-06-25 16:38:51.141 FCM[2546:42883] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9806)
2016-06-25 16:38:51.460 FCM[2546:42455] Connected to FCM.
2016-06-25 16:38:56.709 FCM[2546:42455] InstanceID token: fgbPv5tnsPk:APA91bHUWOmuLmd4UkLXcp3Lysp92fH6bOb7tfmbjHehFOt_NPnc6tnMk-7YT51VASkk-dyHZAl01QRcedwqGUhHMiIXeV_xknBXppncu0WyjKLYhaVQ08bYKNZ5M1CuSjtk9l0HPyJX
2016-06-25 16:38:56.711 FCM[2546:42455] Unable to connect to FCM. Error Domain=com.google.fcm Code=2001 "(null)"
2016-06-25 16:38:57.505 FCM[2546:] <FIRAnalytics/INFO> Firebase Analytics enabled
2016-06-25 16:40:03.845 FCM[2546:42455] Unable to connect to FCM. Error Domain=com.google.fcm Code=2001 "(null)"
2016-06-25 16:40:06.534 FCM[2546:42455] InstanceID token: fgbPv5tns9......
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With