将我的应用升级到 Xcode8/Swift 3 后,我不再收到来自 PKPushRegistryDelegate
的回调。
我已验证 Apple´s Voice Over IP (VoIP) Best Practices 中的所有步骤.
我的设备记录了以下可能相关的内容:
callservicesd[92] : [WARN] Ignoring voipRegister request because either no bundleIdentifier could be determined (0) or no environment could be determined (1)
我的应用程序委托(delegate):
var voipRegistry: PKPushRegistry!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
voipRegistry = PKPushRegistry(queue: DispatchQueue.main)
voipRegistry.delegate = self
voipRegistry.desiredPushTypes = Set([.voIP])
}
extension AppDelegate: PKPushRegistryDelegate {
func pushRegistry(_ registry: PKPushRegistry, didInvalidatePushTokenForType type: PKPushType) {
print("didInvalidatePushTokenForType")
}
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, forType type: PKPushType) {
print("Incoming voip notfication: \(payload.dictionaryPayload)")
}
func pushRegistry(_ registry: PKPushRegistry, didUpdate credentials: PKPushCredentials, forType type: PKPushType) {
print("voip token: \(credentials.token)")
}
}
最佳答案
关于ios - PushKit PKPushRegistryDelegate 没有得到回调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40829550/