尝试发送PKPush时服务器收到错误

时间:2017-10-24 21:25:56

标签: ios swift push voip

我在iOS端使用以下代码来使PKPush通知正常工作。 didUpdate被调用,服务器正在向正确的令牌发送推送但服务器收到此错误:

  

从APNS服务器收到错误响应数据包:APNS:[1]无效令牌。

func voipRegistration() {
            let voipRegistry: PKPushRegistry = PKPushRegistry(queue: DispatchQueue.main)
            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) {
            NSLog("Device token \(deviceTokenString)")
        }


        func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
            //
        }

我设置了以下背景模式:

<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
    <string>voip</string>
    <string>fetch</string>
    <string>remote-notification</string>
</array>

当服务器指向沙箱时,我指向我的开发证书。我做错了什么?

0 个答案:

没有答案