小编dav*_*as 的帖子

在检索发件人 ID 的 FCM 令牌之前未设置错误 APNS 设备令牌

我正在从 firebase 接收带有 APN 的通知的消息。在 Firebase 中,我有 APNs 密钥的证书,与从 Apple Developer 中提取的 Firebase 中的 Xcode 项目中具有相同的 id。

但我不知道为什么会发生这种情况,我收到此错误,它正在消息传递扩展中注册两个令牌:

extension AppDelegate : MessagingDelegate {
  func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {}}
Run Code Online (Sandbox Code Playgroud)

在检索发件人 ID“########”的 FCM 令牌之前未设置 APNS 设备令牌。对此 FCM 令牌的通知将不会通过 APNS 传递。设置 APNS 设备令牌后,请务必重新检索 FCM 令牌。

添加了我在 AppDelegate 中的内容

import Firebase
import MasivPushIosSdk

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate{

    var firebaseToken: String = ""
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        FirebaseApp.configure()
        self.registerForFirebaseNotification(application: application)
        Messaging.messaging().delegate = self
        return …
Run Code Online (Sandbox Code Playgroud)

push-notification access-token ios firebase firebase-cloud-messaging

16
推荐指数
3
解决办法
4万
查看次数