Ios Firebase云消息可以';如果从现有应用商店版本更新,则不会收到消息

Ios Firebase云消息可以';如果从现有应用商店版本更新,则不会收到消息,ios,firebase-cloud-messaging,app-store,testflight,Ios,Firebase Cloud Messaging,App Store,Testflight,我的应用程序具有FCM和消息有效负载设置,在Xcode调试模式下运行时,以及在测试人员从TestFlight下载发布版本时,使用APNs Auth Key成功运行。应用商店ID和团队ID也在Firebase项目设置中正确设置 但是,我发现如果我首先从AppStore安装应用程序(构建有相应的GoogleService-Info.plist,但尚未实现完整的FCM功能),然后通过TestFlight构建覆盖构建(此构建有完整的FCM功能),应用程序仍然可以获取FCM令牌,但似乎没有收到任何FCM消

我的应用程序具有FCM和消息有效负载设置,在Xcode调试模式下运行时,以及在测试人员从TestFlight下载发布版本时,使用APNs Auth Key成功运行。应用商店ID和团队ID也在Firebase项目设置中正确设置

但是,我发现如果我首先从AppStore安装应用程序(构建有相应的GoogleService-Info.plist,但尚未实现完整的FCM功能),然后通过TestFlight构建覆盖构建(此构建有完整的FCM功能),应用程序仍然可以获取FCM令牌,但似乎没有收到任何FCM消息。如果我使用Firebase的Notification composer发送带有接收到的令牌的消息,应用程序实际上可以接收到该通知,因此这意味着应该正确设置APN

我搜索过类似的问题,发现其中似乎有类似的问题,但仍然有点不同的我的问题。但是没有答案,所以我还是不知道

我的问题是,当直接从TestFlight下载(运行良好)和从AppStore“重写”时,是什么原因导致应用程序上的FCM工作方式不同?另外,我最担心的是,当应用程序最终从AppStore旧版本更新到新版本时,FCM是否会起作用

与在AppDelegate中接收消息/通知相关的一些代码设置。我省略了委托设置代码

//Handle messages with method swizzling disabled
@available(iOS 10, *)
extension AppDelegate : UNUserNotificationCenterDelegate {

   func userNotificationCenter(_ center: UNUserNotificationCenter,
                          willPresent notification: UNNotification,
    withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
       let userInfo = notification.request.content.userInfo
    
       os_log("didReceiveRemoteNotification: %{public}@", log: LogCategories.FCMSetup, type: .debug, userInfo)

       AppDelegate.getFcmClient().processMessaging(center, willPresent: notification, withCompletionHandler: completionHandler)

       // With swizzling disabled you must let Messaging know about the message, for Analytics
       Messaging.messaging().appDidReceiveMessage(userInfo)
    }

    // This is received when app is backgrounded and then reopen
    func userNotificationCenter(_ center: UNUserNotificationCenter,
                          didReceive response: UNNotificationResponse,
                          withCompletionHandler completionHandler: @escaping () -> Void) {
        let userInfo = response.notification.request.content.userInfo
        if let messageID = userInfo[FCMClient.gcmMessageIDKey] {
            print("Message ID: \(messageID)")
        }
        os_log("didReceiveUserNotification: %{public}@", log: LogCategories.FCMSetup, type: .debug, userInfo)

        completionHandler()
    }

}

extension AppDelegate : MessagingDelegate {

    func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
        // Note: This callback is fired at each app startup and whenever a new token is generated.
        AppDelegate.getFcmClient().setNewToken(fcmToken)
    
        let dataDict:[String: String] = ["token": fcmToken]
        NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict)
        os_log("Firebase registration token received: %{public}@", log: LogCategories.FCMSetup, type: .debug, fcmToken)
    }

    func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage) {
        AppDelegate.getFcmClient().processMessaging(messaging, didReceive: remoteMessage)
    }

}

事实证明,即使直接从App Store旧版本(无FCM)更新到App Store新版本(有FCM),也无法接收云消息,除非删除并重新安装该应用。我想知道是否在应用程序安装中缓存了任何与生成相关的属性,并且除非删除该应用程序,否则无法更改这些属性…您可以将appstore的通知证书放在firebase控制台中吗??