I am using PushKit framework , adding the code in didFinishLaunchingWithOptions
let voipRegistry: PKPushRegistry = PKPushRegistry(queue: dispatch_get_main_queue())
voipRegistry.delegate = self
voipRegistry.desiredPushTypes = NSSet(object: PKPushTypeVoIP) as! Set<NSObject>
// Registering the Token
func pushRegistry(registry: PKPushRegistry!, didUpdatePushCredentials credentials: PKPushCredentials!, forType type: String!) {
}
// Receiving the Notification
func pushRegistry(registry: PKPushRegistry!, didReceiveIncomingPushWithPayload payload: PKPushPayload!, forType type: String!) {
let content = payload.dictionaryPayload["aps"] as? Dictionary<String,String>
let message = content!["alert"]
let notification = UILocalNotification()
notification.alertTitle = "Hifi"
notification.alertBody = message
notification.alertLaunchImage = "logo_white.png"
notification.soundName = "Glass.caf"
UIApplication.sharedApplication().presentLocalNotificationNow(notification)
}
i have implemeted like that but not receiving notification How to handle the notification in didReceiveIncomingPushWithPayload delegate method?
Also check your pem and another things.
Go through https://www.raywenderlich.com/123862/push-notifications-tutorial
Download
Life cycle of app - when app is in terminated and push kit payload comes