Ios 未调用Voip服务(PKPush)委托方法
我正在尝试设置一个PKPushRegistry,这样我就可以接收VOIP服务推送,但我的代理没有启动。我成功地恢复了一个devicetoken,因此我知道该过程的第一部分正在工作。此外,我的服务器具有两种推送的正确证书Ios 未调用Voip服务(PKPush)委托方法,ios,swift,push-notification,voip,Ios,Swift,Push Notification,Voip,我正在尝试设置一个PKPushRegistry,这样我就可以接收VOIP服务推送,但我的代理没有启动。我成功地恢复了一个devicetoken,因此我知道该过程的第一部分正在工作。此外,我的服务器具有两种推送的正确证书 class AppDelegate: UIResponder, UIApplicationDelegate, PKPushRegistryDelegate { func application(_ application: UIApplication, didRegiste
class AppDelegate: UIResponder, UIApplicationDelegate, PKPushRegistryDelegate {
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
self.voipRegistration()
}
func voipRegistration() {
let mainQueue = DispatchQueue.main
let voipRegistry: PKPushRegistry = PKPushRegistry(queue: mainQueue)
voipRegistry.delegate = self
voipRegistry.desiredPushTypes = [PKPushType.voIP]
}
func pushRegistry(_ registry: PKPushRegistry, didInvalidatePushTokenFor type: PKPushType) {
//
}
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) {
//
}
func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {
//
}
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
//
}
苹果将VOIP从后台模式中移除,所以我手动添加了它,它就工作了
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>voip</string>
<string>fetch</string>
<string>remote-notification</string>
</array>
ui背景模式
音频
网络电话
取来
远程通知
在我的例子中,当设备需要推送权限时,第一次没有调用didUpdate。但pushkit在控制台中打印设备令牌。当我通过这个令牌发送推送时,推送将在应用程序处于前台、后台甚至关闭期间到来。在这种情况下,如果我重新启动应用程序,就会被称为“正常工作”。但在pushkit注册期间,我仍然需要在didUpdate中记录设备令牌。。感谢您的帮助。