可复制:didRegisterForRemoteNotificationsWithDeviceToken随机停止被调用

问题描述 投票:1回答:1

didRegisterForRemoteNotificationsWithDeviceToken工作几周后突然停止被调用。

我可以在a fresh Xcode project (.zip)中重现该问题,因此几乎可以确定这是签名/设置配置文件问题。该令牌在AppStore版本中按预期返回,但在装有iOS 13的iPhone上从Xcode 11.3运行时未返回。

我已经阅读了每个相关的问题(以及followed和这些steps),但没有任何问题可以解决。

这是我尝试过的:

  1. 我使用的是真实的iPhone,而不是模拟器
  2. 尝试通过蜂窝和WiFi
  3. 创建新的捆绑包ID
  4. 已检查应用程序标识符是显式的(无通配符)
  5. 清除了Keychain.app和〜/ Library / MobileDevice / Provisioning Profiles /中的所有证书>]
  6. 使用开发者帐户重新注册的设备
  7. 从developer.apple.com删除并重新创建的开发证书
  8. 多次重新生成,下载并重新安装开发证书
  9. 在Xcode中通过手动和“自动管理签名”对上述方法进行了尝试
  10. 已确认的配置文件包含aps环境条目(screenshot
  11. 在功能/权利中添加了“背景模式:通知”
  12. 尝试删除通知和后台功能,然后重新添加它们
  13. 确认其他AppStore应用程序可以将通知发送到设备
  14. 检查APNS server是否打开
  15. 在以上所有更改之间多次重新启动设备
  16. 每天尝试向推送通知神祈祷
  17. 知道有什么问题吗?

代码非常简单:

class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Also tried calling after launch finishes.
        // Calling UNUserNotificationCenter.current().requestAuthorization first also never returns a token.
        UIApplication.shared.registerForRemoteNotifications();
        return true
    }

    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        // This method is never called.
        let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined();
        print("💌 Received notification token: (\(token))");
    }

    func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
        // This method is never called either (unless I remove aps entitlements).
        print("💌 Did fail to register for notifications: \(error)");
    }

}
    

didRegisterForRemoteNotificationsWithDeviceToken在工作几周后突然停止被调用。我可以在一个新的Xcode项目(.zip)中重现该问题,因此几乎可以确定它是......>

swift xcode push-notification apple-push-notifications provisioning-profile
1个回答
0
投票

原来这是苹果公司的问题。这是我从开发人员支持部门收到的消息:

跟进:736344716

© www.soinside.com 2019 - 2024. All rights reserved.