IOS Firebase - Failed to get default token Error Domain = com.firebase.iid Code = 501

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

I use the following library versions: Firebase 3.6.0, FirebaseInstanceID 1.0.8, FirebaseMessaging 1.2.0

When testing on the device, "didRegisterForRemoteNotificationsWithDeviceToken" is deleted, and I get a valid device token, however I can not successfully extract the FCM registration token.

I struggled with this for several days, but I’m not going anywhere. Below is the corresponding code snippet and 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
+4
source share

Source: https://habr.com/ru/post/1655209/


All Articles