didRegisterForRemoteNotificationsWithDeviceToken工作几周后突然停止被调用。
我可以在a fresh Xcode project (.zip)中重现该问题,因此几乎可以确定这是签名/设置配置文件问题。该令牌在AppStore版本中按预期返回,但在装有iOS 13的iPhone上从Xcode 11.3运行时未返回。
我已经阅读了每个相关的问题(以及followed和这些steps),但没有任何问题可以解决。
知道有什么问题吗?
代码非常简单:
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)中重现该问题,因此几乎可以确定它是......>
原来这是苹果公司的问题。这是我从开发人员支持部门收到的消息:
跟进:736344716