4

I'm trying to integrate Firebase into my app. I’m using Xcode 7.3 & Cocoapods 1.0.1. I created an APNS dev push certificate and uploaded the p12 file to my Firebase project. I downloaded GoogleService-Info.plist and added it to the root of my project. I then followed the instructions here for setting up push notifications (https://firebase.google.com/docs/cloud-messaging/ios/client).

I'm using the following library versions: Firebase 3.6.0, FirebaseInstanceID 1.0.8, FirebaseMessaging 1.2.0

When testing on a device, the 'didRegisterForRemoteNotificationsWithDeviceToken' gets hit and I get a valid device token however I am unable to successfully retrieve a FCM registration token.

I've been struggling with this for a couple of days but not getting anywhere. Below is the relevant code snippet and the console log errors.

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSString *devToken = [[[[deviceToken description]
                        stringByReplacingOccurrencesOfString:@"<"withString:@""]
                       stringByReplacingOccurrencesOfString:@">" withString:@""]
                      stringByReplacingOccurrencesOfString: @" " withString: @""];

NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken with token: %@", devToken);

[[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeSandbox];
}


2016-10-19 10:23:09.523: <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-10-19 10:23:09.872: <FIRInstanceID/WARNING> APNS Environment in profile: development
2016-10-19 10:23:11.761: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=501 "The operation couldn’t be completed. (com.firebase.iid error 501.)"
2016-10-19 10:23:25.759: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=501 "The operation couldn’t be completed. (com.firebase.iid error 501.)"
2016-10-19 10:23:54.365: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=501 "The operation couldn’t be completed. (com.firebase.iid error 501.)"
2016-10-19 10:24:38.482: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=501 "The operation couldn’t be completed. (com.firebase.iid error 501.)"
2016-10-19 10:25:42.257: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=501 "The operation couldn’t be completed. (com.firebase.iid error 501.)"
2016-10-19 10:25:42.257: <FIRInstanceID/WARNING> Failed to retrieve the default GCM token after 5 retries
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
vmob
  • 51
  • 1
  • 2
  • 1
    Possible duplicate of [Failed to fetch default token Error Domain=com.firebase.iid Code=501 "(null)"](http://stackoverflow.com/questions/37443334/failed-to-fetch-default-token-error-domain-com-firebase-iid-code-501-null) – Paul Beusterien Oct 24 '16 at 17:54
  • Can you add the code snippet when you setup the Firebase app? – iDev Jul 17 '17 at 18:10

0 Answers0