{"id":2314,"date":"2017-01-05T12:36:59","date_gmt":"2017-01-05T07:06:59","guid":{"rendered":"https:\/\/www.innovationm.com\/blog\/?p=2314"},"modified":"2017-02-03T18:22:04","modified_gmt":"2017-02-03T12:52:04","slug":"push-notification-handling-in-swift-3-0","status":"publish","type":"post","link":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/","title":{"rendered":"Push Notification Handling in Swift 3.0"},"content":{"rendered":"<p><strong>Notifications:<\/strong><br \/>\nThere are two types of notifications:<\/p>\n<ul>\n<li><em>Local Notification<\/em><\/li>\n<li><em>Remote Notification (Push Notification)<\/em><\/li>\n<\/ul>\n<p><strong><em>Local notifications<\/em><\/strong> are scheduled and sent by an app and delivered on the same device without involvement of internet.<\/p>\n<p><strong><em>Remote Notification (Push Notification):<\/em><\/strong> Push notifications are sent by remote server to the APNs\u00a0and then it pushes the notification to the specific device.<\/p>\n<p><strong>Push Notification Integration in Application:<\/strong><br \/>\nTo integrate Push notification in your application, you need to perform certain task as followed:<\/p>\n<ul>\n<li><em>Configure An App for push notification<\/em><\/li>\n<li><em>Register your device to APNs\u00a0server.<\/em><\/li>\n<li><em>Make a provider (server) which sent notification to your app.<\/em><\/li>\n<li><em>Send device token to server<\/em><\/li>\n<li><em>Make a payload which contain all necessary information needed by your app and send it to APNs.<\/em><\/li>\n<li><em>Handle the received notification using callbacks\u00a0in AppDelegate.<\/em><\/li>\n<li><em>Configure App for Push Notification<\/em><\/li>\n<\/ul>\n<p>Push notification requires more security. There are few steps to configure your app with push notification.<br \/>\nTo Enable the Push Notification Service:<\/p>\n<ol>\n<ol>\n<li>Change your App ID to something unique. For that go to <em>App Settings -&gt; General and change Bundle Identifier\u00a0<\/em><\/li>\n<li>To Enable push notification go to <em>App Settings -&gt; Capabilities -&gt; Push Notification and turn the switch on.\u00a0<a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/enable_push_noti.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-2328\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/enable_push_noti.png\" alt=\"enable_push_noti\" width=\"619\" height=\"112\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/enable_push_noti.png 619w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/enable_push_noti-300x54.png 300w\" sizes=\"(max-width: 619px) 100vw, 619px\" \/><\/a><\/em><\/li>\n<li><strong>(Only in Xcode\u00a08)<\/strong> Go to Background Modes and turn it On. Check Remote Notifications option.<img decoding=\"async\" class=\"alignnone size-full wp-image-2327\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/background_modes.png\" alt=\"background_modes\" width=\"605\" height=\"281\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/background_modes.png 605w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/background_modes-300x139.png 300w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><\/li>\n<\/ol>\n<\/ol>\n<p><strong>Registering for Push Notifications:<\/strong><\/p>\n<p>To register for Push notification we need to add some code in AppDelegate.swift class. For iOS 10 import UserNotifications Framework in AppDelegate file.<\/p>\n<p>1. Register Device on APNs: For registration, add the following code in application(_:didFinishLaunchingWithOptions:launchOptions:) method:<\/p>\n<pre class=\"lang:default decode:true \">func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool {\r\n\r\n        if #available(iOS 10.0, *) {\r\n            let center = UNUserNotificationCenter.current()\r\n            center.delegate = self\r\n            center.requestAuthorization(options: [.badge, .sound, .alert], completionHandler: {(grant, error)  in\r\n\t\tif error == nil {\r\n                    if grant {\r\n                        application.registerForRemoteNotifications()\r\n                    } else {\r\n                        \/\/User didn't grant permission\r\n                    }\r\n                } else {\r\n                    print(\"error: \",error)\r\n                }\r\n            })\r\n        } else {\r\n            \/\/ Fallback on earlier versions\r\n            let notificationSettings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)\r\n            application.registerUserNotificationSettings(notificationSettings)\r\n        }\r\n        return true\r\n    }<\/pre>\n<p><strong>For iOS 10<\/strong>, get the object of current notification center by <em>UNUserNotificationCenter.current()<\/em> and set the delegate.<br \/>\n<strong>requestAuthorization(&#8230;)<\/strong> method used to request to authorization to interact with user when notification arrives. The first time this method is called it shows a prompt to user to authorize the requested options. In completion of this method you need to call registerForRemoteNotifications(). It is used to register our application on APNs for push notifications.<br \/>\nFor earlier versions of iOS, create the object of UIUserNotificationSettings and register it with registerUserNotificationSettings(_:) method.<\/p>\n<p>For the UIUserNotificationTypes, you can use any combination of the following:<br \/>\n-&gt; <strong><em>.badge<\/em><\/strong>, allows the app to show the number of notifications on the corner of the app\u2019s icon.<br \/>\n-&gt; <strong><em>.sound<\/em><\/strong>, allows the app to play a sound.<br \/>\n-&gt; <strong><em>.alert<\/em><\/strong>, allows the app to display text via banner or alert.<\/p>\n<p>2. Methods To Implement Push Notification:<\/p>\n<p>Add following methods to register device on APNs and get device token:<\/p>\n<p>application(_:didRegisterUserNotificationSettings:) This method is used for iOS 9 and below. It provide you the current permissions for push notification which is allowed in your app.<br \/>\n<code><br \/>\n<\/code><\/p>\n<pre class=\"lang:default decode:true\">func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {\r\n  if notificationSettings.types != .none {\r\n    application.registerForRemoteNotifications()\r\n  }\r\n}<\/pre>\n<p>application(_:didRegisterForRemoteNotificationsWithDeviceToken:) This method is called when device is registered successfully with APNs server. It provide you device token.<\/p>\n<p><code><br \/>\n\/\/ Token registered<br \/>\n<\/code><\/p>\n<pre class=\"lang:default decode:true\">func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {\r\n  let tokenString = hexString(data: deviceToken)\r\n  print(\"token: \", tokenString)\r\n}<\/pre>\n<p>application(_:didFailToRegisterForRemoteNotificationsWithError:) If device token is not generated by APNs then this method calls. It give you NSError object which describe the error in device registration.<\/p>\n<p><code>\u00a0<\/code><\/p>\n<pre class=\"lang:default decode:true\">func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {\r\n  let tokenString = deviceToken.reduce(\"\") { string, byte in\r\n    string + String(format: \"%02X\", byte)\r\n  }\r\n  print(\"token: \", tokenString)\r\n}<\/pre>\n<p>3. Create an SSL Certificate and .p12 file:<a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/csr.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-2330\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/csr.png\" alt=\"csr\" width=\"628\" height=\"255\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/csr.png 628w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/csr-300x122.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/csr-624x253.png 624w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><\/a><\/p>\n<p>The Certificate Signing Request: Open the <em>Keychain Access&gt; Certificate Assistant&gt; Request a Certificate From a Certificate Authority\u2026<\/em><\/p>\n<p>In the opened window, fill all the mandatory field User Email Address and Common Name fields. Besides that, click to the <em>Saved to disk<\/em> option to save the CSR file to the disk.<a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/cer_info.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2331\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/cer_info.png\" alt=\"cer_info\" width=\"618\" height=\"436\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/cer_info.png 618w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/cer_info-300x212.png 300w\" sizes=\"(max-width: 618px) 100vw, 618px\" \/><\/a><\/p>\n<p>Click <em>Continue<\/em> and optionally choose a folder and a name for the CSR file right before you save it.<\/p>\n<p><strong><em>Configure the App ID for Push Notifications:<\/em><\/strong><br \/>\nFor iOS 10, you need not to add the provisioning profile in your developer account. Xcode 8 create all necessary certificates automatically. But you need to create SSL certificate. To do that, open your developer Account. Now select <em>Certificates, Identifiers &amp; Profiles &gt; Identifiers &gt; App IDs.<\/em> Select your app id.<\/p>\n<p>Now click on Edit and scroll down to Push Notifications section. Here are two sections which are used to create SSL Certificates for both the Development and Production stage. Click on first <em>Create Certificate<\/em>\u2026 button to create certificate for push notification for development.<a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/create_cert.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2332\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/create_cert.png\" alt=\"create_cert\" width=\"641\" height=\"410\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/create_cert.png 641w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/create_cert-300x192.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/create_cert-624x399.png 624w\" sizes=\"(max-width: 641px) 100vw, 641px\" \/><\/a><\/p>\n<p>Now click on Continue button. Next, click to the Choose File\u2026 button and select the CSR certificate you just created.<a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/choose_file.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2333\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/choose_file.png\" alt=\"choose_file\" width=\"616\" height=\"372\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/choose_file.png 616w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/choose_file-300x181.png 300w\" sizes=\"(max-width: 616px) 100vw, 616px\" \/><\/a><\/p>\n<p><em>Click on Continue\u2026<\/em><br \/>\nHere you have a new certificate which enable you to send notification in development mode. Download that certificate from here by clicking on Download button.<br \/>\nThe name of downloaded file is <em>aps_development.cer<\/em>. Open the downloaded file in downloads Folder. Open That file by double click. It\u2019ll be added in your Keychain Access. (Make sure that the new certificate is added in login Keychain. If it is in any other keychain option then move it in login)<\/p>\n<p>When your certificate is added in Keychain Access, right click on it and select <em>Export<\/em> \u201c\u2026\u201d option. Be sure that the .p12 file format is selected. Now click on Save button. If you do not want to add the password in it then simply click on OK button. If you set password then note it down somewhere.<br \/>\nRepeat same steps to create certificate for Production.<\/p>\n<p><strong>Send Push Notification:<\/strong><br \/>\nRegister Device on Server: Send device token to your provider(server) in either binary or hexadecimal format.<\/p>\n<p><span style=\"font-weight: 400\"><strong>NOTE:<\/strong> Update device token on server only when the device token is changed from APNs. If device token is same and already registered with your server then you do not need to update it.<\/span><\/p>\n<p>To send push notification you need to specify three things:<\/p>\n<ul>\n<li><em>The device token of the target device.<\/em><\/li>\n<li><em>The path to the push notification certificate file.<\/em><\/li>\n<li><em>The payload of the push notification (message, badge number, sound etc).<\/em><\/li>\n<\/ul>\n<p><strong>Send Push Notification Request to APNs:<\/strong><\/p>\n<p>To send notification your server needs to perform three main tasks:<\/p>\n<ul>\n<li><em>Generate a notification payload.<\/em><\/li>\n<li><em>Attach Payload and the device token to an HTTP\/2 request.<\/em><\/li>\n<li><em>Send this request to APNs over a persisted and secure channel.<\/em><\/li>\n<\/ul>\n<p>Here is an example of payload:<br \/>\n<code><br \/>\n<\/code><\/p>\n<pre class=\"lang:default decode:true\">{\r\n  \u201caps\u201d : {\r\n    \u201calert\u201d : {\r\n      \u201ctitle\u201d : \u201cNITL ACUMEN BI RFS CODA Dev Offshore\u201d,\r\n      \u201cbody\u201d : \u201cSend a Message - PN testing group\u201d\r\n    },\r\n    \u201csound\u201d : \u201cdefault\u201d\r\n  },\r\n  \u201cgroupName\u201d : \u201cTesting Group\u201d,\r\n  \u201ctype\u201d : \u201cSend a Message\u201d,\r\n  \u201cprojectId\u201d : 186\r\n}<\/pre>\n<p>If you need to test push notification on your app then you can use <a href=\"\/\/itunes.apple.com\/us\/app\/apn-tester-free\/id626590577?mt=12\u201d\">APN Tester Free<\/a>. In this application you just need to enter device token of your device, payload and browse the certificate which is downloaded from your developer account and then press Push button. You will receive a notification.<br \/>\n<strong>Push Notification Handling on Device:<\/strong><br \/>\n1.<em> If you have version iOS 9.3 or below then implement<\/em> application(_:didReceiveRemoteNotification:). In this method you can perform the action what you want to perform on receiving a notification. You can have a callback in this method if your app is active. If your application is in background or inactive then this method is called when you tap on the notification.<\/p>\n<pre class=\"lang:default decode:true\">func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {\r\n  print(userInfo)\r\n  if application.applicationState == .active {\r\n    \/\/write your code here when app is in foreground\r\n  } else {\r\n    \/\/write your code here for other state\r\n  }\r\n}<\/pre>\n<p>You will receive the payload in userInfo. You can retrieve all the information sent in your payload. We do not get push notification in Active state of App.<\/p>\n<p>2. <em>In iOS 10 we can get notification in active state. To handle a notification in Active state use implement method userNotificationCenter(_:willPresent :withCompletionHandler)<\/em><\/p>\n<pre class=\"lang:default decode:true\">@available(iOS 10.0, *)\r\nfunc userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -&gt; Void) {\r\n  completionHandler(.alert)\r\n}<\/pre>\n<p>Here you can pass the notification option in the completion block. This will show you the notification on the notification center even if your application is in Foreground.<\/p>\n<p>3. <em>When you tap on the notification userNotificationCenter(_: didReceive :withCompletionHandler) method will be called. Here you can define your action what you want to perform on notification.<\/em><\/p>\n<pre class=\"lang:default decode:true\">@available(iOS 10.0, *)\r\nfunc userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -&gt; Void) {\r\n  print(response)\r\n  \/\/write your action here\r\n}<\/pre>\n<p>4. <em>When app is in killed state. Then on the tap of notification application(_:didFinishLaunchingWithOptions) method will be called. launchOption contains the payload if app is launched by tap on notification. For that write the given code in this method<\/em>:<\/p>\n<pre class=\"lang:default decode:true\">if launchOptions != nil{\r\n  let userInfo = launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification]\r\n  if userInfo != nil {\r\n    \/\/ Perform action here\r\n  }\r\n}<\/pre>\n<p>After doing all this you will be able to receive and handle the push notification.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Notifications: There are two types of notifications: Local Notification Remote Notification (Push Notification) Local notifications are scheduled and sent by an app and delivered on the same device without involvement of internet. Remote Notification (Push Notification): Push notifications are sent by remote server to the APNs\u00a0and then it pushes the notification to the specific device. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2338,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,71],"tags":[178],"class_list":["post-2314","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ios","category-mobile","tag-swift-3-0"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Push Notification Handling in Swift 3.0 | InnovationM Blog<\/title>\n<meta name=\"description\" content=\"Steps of Push Notification Handling in Swift 3.0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Push Notification Handling in Swift 3.0 | InnovationM Blog\" \/>\n<meta property=\"og:description\" content=\"Steps of Push Notification Handling in Swift 3.0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/\" \/>\n<meta property=\"og:site_name\" content=\"InnovationM - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-05T07:06:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-02-03T12:52:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/Applepush1-2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"InnovationM Admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InnovationM Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/\"},\"author\":{\"name\":\"InnovationM Admin\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"headline\":\"Push Notification Handling in Swift 3.0\",\"datePublished\":\"2017-01-05T07:06:59+00:00\",\"dateModified\":\"2017-02-03T12:52:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/\"},\"wordCount\":1240,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/01\\\/Applepush1-2.jpg\",\"keywords\":[\"Swift 3.0\"],\"articleSection\":[\"iOS\",\"Mobile\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/\",\"name\":\"Push Notification Handling in Swift 3.0 | InnovationM Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/01\\\/Applepush1-2.jpg\",\"datePublished\":\"2017-01-05T07:06:59+00:00\",\"dateModified\":\"2017-02-03T12:52:04+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"description\":\"Steps of Push Notification Handling in Swift 3.0\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/01\\\/Applepush1-2.jpg\",\"contentUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/01\\\/Applepush1-2.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/push-notification-handling-in-swift-3-0\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Push Notification Handling in Swift 3.0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\",\"name\":\"InnovationM - Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\",\"name\":\"InnovationM Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"caption\":\"InnovationM Admin\"},\"sameAs\":[\"http:\\\/\\\/www.innovationm.com\\\/\"],\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/author\\\/innovationmadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Push Notification Handling in Swift 3.0 | InnovationM Blog","description":"Steps of Push Notification Handling in Swift 3.0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/","og_locale":"en_US","og_type":"article","og_title":"Push Notification Handling in Swift 3.0 | InnovationM Blog","og_description":"Steps of Push Notification Handling in Swift 3.0","og_url":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/","og_site_name":"InnovationM - Blog","article_published_time":"2017-01-05T07:06:59+00:00","article_modified_time":"2017-02-03T12:52:04+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/Applepush1-2.jpg","type":"image\/jpeg"}],"author":"InnovationM Admin","twitter_misc":{"Written by":"InnovationM Admin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/#article","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/"},"author":{"name":"InnovationM Admin","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"headline":"Push Notification Handling in Swift 3.0","datePublished":"2017-01-05T07:06:59+00:00","dateModified":"2017-02-03T12:52:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/"},"wordCount":1240,"commentCount":0,"image":{"@id":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/Applepush1-2.jpg","keywords":["Swift 3.0"],"articleSection":["iOS","Mobile"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/","url":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/","name":"Push Notification Handling in Swift 3.0 | InnovationM Blog","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/#primaryimage"},"image":{"@id":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/Applepush1-2.jpg","datePublished":"2017-01-05T07:06:59+00:00","dateModified":"2017-02-03T12:52:04+00:00","author":{"@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"description":"Steps of Push Notification Handling in Swift 3.0","breadcrumb":{"@id":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/#primaryimage","url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/Applepush1-2.jpg","contentUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/01\/Applepush1-2.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/www.innovationm.com\/blog\/push-notification-handling-in-swift-3-0\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.innovationm.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Push Notification Handling in Swift 3.0"}]},{"@type":"WebSite","@id":"https:\/\/www.innovationm.com\/blog\/#website","url":"https:\/\/www.innovationm.com\/blog\/","name":"InnovationM - Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.innovationm.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed","name":"InnovationM Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","caption":"InnovationM Admin"},"sameAs":["http:\/\/www.innovationm.com\/"],"url":"https:\/\/www.innovationm.com\/blog\/author\/innovationmadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/2314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/comments?post=2314"}],"version-history":[{"count":0,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/2314\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media\/2338"}],"wp:attachment":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media?parent=2314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/categories?post=2314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/tags?post=2314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}