Sub*_*dal 14 objective-c ios firebase firebase-authentication firebase-cloud-messaging
我想将Firebase Cloud Messaging与我的应用程序集成,但是当我运行应用程序时,我遇到以下错误:
<FIRMessaging/WARNING> FIRMessaging registration is not ready with auth credentials.
Unable to connect to FCM. Error Domain=com.google.fcm Code=501 "(null)"
这是我的代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) {
// iOS 7.1 or earlier
UIRemoteNotificationType allNotificationTypes =
(UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge);
[application registerForRemoteNotificationTypes:allNotificationTypes];
} else {
// iOS 8 or later
// [END_EXCLUDE]
UIUserNotificationType allNotificationTypes =
(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);
UIUserNotificationSettings *settings =
[UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
[FIRApp configure];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tokenRefreshNotification:) name:kFIRInstanceIDTokenRefreshNotification object:nil];
return YES;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1519 次 |
最近记录: |