pushRegistry:didUpdate:pushCredentials 未被调用

pushRegistry:didUpdate:pushCredentials not being called

查看了过去关于此的问题,但这些问题的答案已应用于我的项目,但未调用 pushRegistry() 委托方法。

首先是代码:

import UIKit
import PushKit
import UserNotifications

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate{

    var window: UIWindow?
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        let notificationSettings  = UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil)
        application.registerUserNotificationSettings(notificationSettings)

        UNUserNotificationCenter.current().delegate = self
        UIApplication.shared.registerForRemoteNotifications()

        let voipRegistry = PKPushRegistry(queue: DispatchQueue.main)
        voipRegistry.desiredPushTypes = Set([PKPushType.voIP])
        voipRegistry.delegate = self;

        return true
    }
...
}

extension AppDelegate: PKPushRegistryDelegate {
    func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {
        NSLog("voip token: \(pushCredentials.token)")
    }

已启用以下应用程序功能: - 推送通知 - 背景模式 - 后台获取 - 远程通知

我正在使用 Xcode 9.1 Beta,它不再将 Voip 作为一项显式功能,显然这不再需要,导入 PushKit 就足够了。

在配置门户上,已为应用程序 ID 启用推送通知。 (已生成 Void Push 证书,但显然还不能使用它发送推送)

apparently this is no longer needed and importing PushKit should suffice.

我读了几篇帖子说这个,但它不正确。 为了让事情正常进行,我不得不手动编辑 info.plist 以将 voip 添加到背景模式列表中。

 <string>voip</string>

Apple 在玩什么?如果仍然需要,为什么他们将此作为功能从 Xcode 中删除?