ios - <FIRMessaging/WARNING> FIRMessaging 注册尚未准备好使用身份验证凭据

标签 ios objective-c firebase firebase-authentication firebase-cloud-messaging

我想将 Firebase 云消息传递与我的应用程序集成,但是当我运行该应用程序时,出现以下错误:

  1. <FIRMessaging/WARNING> FIRMessaging registration is not ready with auth credentials.

  2. 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;
}

最佳答案

一个可能的答案是您还没有为开发和生产添加 Apple APS 证书。这些是在 iOS 上发送推送通知所必需的。您必须拥有付费 Apple 开发者许可证才能生成这些证书。要生成这些,请打开 this link ,然后转到证书,然后单击右上角的加号按钮以创建新证书。然后按照以下页面上的说明进行操作,直到您从 Apple 下载签名证书。然后转到 firebase 控制台,然后转到您的项目。然后单击齿轮,然后单击项目设置。打开云消息,然后在底部上传您的开发和生产证书并输入您在创建它们时使用的密码。希望这对您有所帮助,如果您有任何问题,请随时提出。

关于ios - <FIRMessaging/WARNING> FIRMessaging 注册尚未准备好使用身份验证凭据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39594576/

相关文章:

javascript - 错误类型错误 : Cannot read property 'singlePost' of null in angular 5

firebase - Firebase 云消息传递 (FCM) token 是否唯一?

具有消息排序功能的 Firebase PubSub 触发器

ios - iPad 1 上的应用程序分配是 iPad 2 的 4 倍

ios - 为具有多个目标和不同平台的项目编写 Podfile

javascript - RCTSharedApplication() 委托(delegate)错误 react native

objective-c - swift字典人口问题: type 'AnyObject' does not conform to protocol 'NSCopying'

ios - 标题栏中的 ionic 搜索输入

ios - UIView拥有很强的引用性

ios - 聊天信使 UITableViewCell,加载消息