小编Rap*_*res的帖子

PushKit没有构思凭据

我在这里挣扎了一段时间,可能这是我的错误,但我无法在任何地方找到它,这是一个答案.

我在某些方面实现了PushKit,但没有一个是有效的.

我已经添加了正确的后台模式,以正确的方式实现了回调,didUpdatePushCredentials正在被正常调用...

但是,credentials: PKPushCredentials!变量,给我一个错误指针......它不是空的......不是零...没有任何东西......它根本就没有值......它被分配了垃圾......因为这个原因..我收到了EXC_BREAKPOINT ..

我试过3种不同的设备......行为相同......

我已经创建了VoIP推送证书......

我以不同的方式做到了:

  • 通过在didRegisterForRemotePushNotification之后创建void Push Registry对象
  • 通过创建推送注册表而无需注册远程推送通知...
  • 通过使用主队列,全局队列和自定义队列创建注册表.

总是一样......

这是代码:

extension AppDelegate : PKPushRegistryDelegate {

func registerForVoipPush() {

    self.registry = PKPushRegistry(queue:nil)

    if self.registry != nil {

        self.registry!.delegate = self
        self.registry!.desiredPushTypes = Set<String>(arrayLiteral: PKPushTypeVoIP)
    }

    //let notificationSettings = UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories:nil)
    //UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)
}

func pushRegistry(registry: PKPushRegistry!, didUpdatePushCredentials credentials: PKPushCredentials!, forType type: String!) {

    //print out the VoIP token. We will use this to test the nofications.
    NSLog("voip token: \(credentials.token)") …
Run Code Online (Sandbox Code Playgroud)

voip push ios pushkit

7
推荐指数
1
解决办法
1618
查看次数

标签 统计

ios ×1

push ×1

pushkit ×1

voip ×1