iOS Firebase - 无法获取默认令牌错误域名= com.firebase.iid代码= 501

时间:2016-09-20 15:27:03

标签: ios xcode firebase cocoapods firebase-cloud-messaging

我正在尝试将Firebase集成到我的应用中。我正在使用Xcode 7.3& Cocoapods 1.0.1。我创建了一个APNS开发推送证书并将p12文件上传到我的Firebase项目。我下载了GoogleService-Info.plist并将其添加到我的项目的根目录中。然后,我按照此处的说明设置推送通知(https://firebase.google.com/docs/cloud-messaging/ios/client)。

我正在使用以下库版本:Firebase 3.6.0,FirebaseInstanceID 1.0.8,FirebaseMessaging 1.2.0

在设备上进行测试时,'didRegisterForRemoteNotificationsWithDeviceToken'会被点击,我会获得有效的设备令牌,但是我无法成功检索FCM注册令牌。

我一直在为此苦苦挣扎几天但却没有到达任何地方。以下是相关的代码段和控制台日志错误。

- (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

0 个答案:

没有答案