【问题标题】:FCM integration issue in iOSiOS 中的 FCM 集成问题
【发布时间】:2016-12-13 12:44:39
【问题描述】:

我们正在遵循从 FCM 链接到 cocoapods 的集成步骤 我们能够通过以下行接收令牌:

if let refreshedToken = FIRInstanceID.instanceID().token()

但是当我们尝试通过以下代码连接到 FCM 之后:

    func connectToFcm() {
    FIRMessaging.messaging().connect { (error) in
        if error != nil {
            print("Unable to connect with FCM. \(error)")

            print("Registration to GCM failed with error: \(error?.localizedDescription)")
            let userInfo = ["error": error?.localizedDescription]
            NotificationCenter.default.post(
                name: Notification.Name(rawValue: self.registrationKey), object: nil, userInfo: userInfo)

        } else {
            print("Connected to FCM.")
        }
    }
}

我们收到以下错误:

无法与 FCM 连接。可选(错误域=com.google.fcm 代码=2001 "(null)")

可能是什么问题?

【问题讨论】:

  • 你的问题解决了吗?

标签: ios objective-c swift apple-push-notifications firebase-cloud-messaging


【解决方案1】:

非常简单,如果 FCM 已经连接,请不要尝试再次连接 - 这太麻烦了。

所以我只有一个标志,如果它已经连接,则避免连接 FCM

【讨论】:

  • 我是推送通知的新手。请检查我的问题stackoverflow.com/questions/41198651/…。请帮帮我
  • 是的,它已经解决了,我会尝试在某个时候回答您的问题
  • 感谢您的回复
猜你喜欢
  • 2017-04-27
  • 2021-07-31
  • 1970-01-01
  • 2012-08-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多