Posts

Post not yet marked as solved
13 Replies
Hi Balaji,I had the exact same issue as you did, it appears the system only calls pushRegistry(_:didUpdate:pushCredentials:for:) when the token is updated. See https://developer.apple.com/documentation/pushkit/pkpushregistry/1614472-pushtoken .You can call pushToken(for:) to retrieve the token cached. It appears PKPushRegistry fetches the latest token from the system. func registerForVOIPNotifications() { guard voipRegistry == nil else {return} voipRegistry = PKPushRegistry(queue: nil) voipRegistry.desiredPushTypes = Set([PKPushType.voIP]) voipRegistry.delegate = self useVoipToken(voipRegistry!.pushToken(for: .voIP)) // use latest token cached } func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) { useVoipToken(pushCredentials.token) // update token if needed } private func useVoipToken(_ tokenData: Data?) { // Do whatever with the token }Hope it helps.Hugo.