stoffen
stoffen

Reputation: 569

PushKit PKPushRegistryDelegate does not get callbacks

After upgrading my app to Xcode8/Swift 3, I no longer receive callbacks from the PKPushRegistryDelegate.

I have verified all steps in Apple´s Voice Over IP (VoIP) Best Practices.

My device logs the following that might be related:

callservicesd[92] : [WARN] Ignoring voipRegister request because either no bundleIdentifier could be determined (0) or no environment could be determined (1)

My AppDelegate:

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)")        
    }   
}

Upvotes: 2

Views: 2090

Answers (1)

stoffen
stoffen

Reputation: 569

I figured I had to enable "Push Notifications" under my target´s Capabilities:

enter image description here

Upvotes: 2

Related Questions