{"id":3437,"date":"2017-08-04T13:20:17","date_gmt":"2017-08-04T07:50:17","guid":{"rendered":"https:\/\/www.innovationm.com\/blog\/?p=3437"},"modified":"2017-08-04T13:20:17","modified_gmt":"2017-08-04T07:50:17","slug":"fcm-implementation-in-swift-3-0","status":"publish","type":"post","link":"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/","title":{"rendered":"FCM Implementation in Swift 3.0"},"content":{"rendered":"<h1>Introduction<\/h1>\n<p><strong>Firebase Cloud Messaging\u00a0<\/strong>is a free mobile notification service by Google that enables third-<br \/>\nparty app developers to send notifications from servers to their users. With Firebase Cloud Messaging Service, you can inform a client\u2019s app that a new email or other data is available for sync. It works on the principle of down streaming messages from FCM servers to client\u2019s app and upstream messages from client apps to FCM servers.<\/p>\n<p>In this blog i will explain how to use this feature in our iOS App. This can be achieved via <strong>Notification messages.<\/strong><\/p>\n<p><strong>Notification messages:\u00a0<\/strong>Notification messages have a predefined set of user-visible keys and an optional data payload of custom key-value pairs. Your payload must be like this when you send notification either from Firebase console or from your server.<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"to\" : YOUR_FCM_TOKEN,\r\n    \"notification\" : {\r\n      \"body\" : \"Hello, there\",\r\n      \"title\" : \"Test Notification\",\r\n\u201csound\u201d : \u201cdefault\u201d\r\n    }\r\n\"priority\":\"high\"\r\n\/\/any custom key value pair\r\n  }\r\n<\/pre>\n<p><strong>YOUR_FCM_TOKEN<\/strong> : you will get this token from FCM when you register your app on FCM. But How? It is explained in later part of the post.<\/p>\n<p><strong>sound:<\/strong>\u00a0It is set to default so that you will get the default sound when notification comes. If you&#8217;ll not set this key then there will be no sound.<\/p>\n<p><strong>priority:<\/strong>\u00a0It must be set high in case of Notification messages.<\/p>\n<p>Other type of Payload could be like containing both data and notification.<\/p>\n<ul>\n<li><strong>When in the background<\/strong>, apps receive the notification payload in the notification tray, and only handle the data payload when the user taps on the notification.<\/li>\n<li><strong>When in the foreground<\/strong>, your app receives a bundle with both payloads available.<br \/>\nFor this JSON would be like:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"to\" : \"Your_FCM_Token\",\r\n    \"notification\" : {\r\n      \"body\" : \"great match!\",\r\n      \"title\" : \"Portugal vs. Denmark\",\r\n      \"icon\" : \"myicon\"\r\n    },\r\n    \"data\" : {\r\n      \"Nick\" : \"Mario\",\r\n      \"Room\" : \"PortugalVSDenmark\"\r\n    }\r\n  }<\/pre>\n<\/li>\n<\/ul>\n<h3><b>Add Firebase to your app<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Create a Firebase project in the <\/span><a href=\"https:\/\/console.firebase.google.com\/\"><span style=\"font-weight: 400;\">Firebase console<\/span><\/a><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">. If you already have an existing project, click <strong>Import Google Project<\/strong>. Otherwise, click <strong>Add New Project<\/strong>. This will open a pop up window as:<br \/>\n<img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-3445 size-full\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-06-at-7.38.33-PM.png\" alt=\"\" width=\"449\" height=\"394\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-06-at-7.38.33-PM.png 449w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-06-at-7.38.33-PM-300x263.png 300w\" sizes=\"(max-width: 449px) 100vw, 449px\" \/><\/span><\/span><\/li>\n<li>In this you need to enter your project name that you want to show on your Firebase console. Then click <strong>Create Project<\/strong>.<\/li>\n<li>After doing so you will shown with another window. Here you need to link your iOS app to Firebase So Click Add Firebase to your iOS App. This will open another pop up for<br \/>\nyou asking your app details.<br \/>\n<img decoding=\"async\" class=\"alignleft wp-image-3449 size-full\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-07-at-1.28.58-PM-2.png\" alt=\"\" width=\"695\" height=\"667\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-07-at-1.28.58-PM-2.png 695w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-07-at-1.28.58-PM-2-300x288.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-07-at-1.28.58-PM-2-624x599.png 624w\" sizes=\"(max-width: 695px) 100vw, 695px\" \/><span style=\"font-size: 1rem;\">So Here enter your app&#8217;s <\/span><strong style=\"font-size: 1rem;\">Bundle ID.\u00a0<\/strong><span style=\"font-size: 1rem;\">It&#8217;s important to enter the bundle ID your app is using; this can only be set when you add an app to your Firebase project.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Click <strong>Register App<\/strong>.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Then you&#8217;ll download a <\/span><b>GoogleService-Info.plist<\/b><span style=\"font-weight: 400;\"> file. You can download this file again at any time.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> You have to put this file at the project&#8217;s root directory.<br \/>\n<img decoding=\"async\" class=\"alignleft wp-image-3447 size-full\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-07-at-1.35.11-PM.png\" alt=\"\" width=\"693\" height=\"667\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-07-at-1.35.11-PM.png 693w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-07-at-1.35.11-PM-300x289.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-07-at-1.35.11-PM-624x601.png 624w\" sizes=\"(max-width: 693px) 100vw, 693px\" \/> <\/span><\/li>\n<\/ul>\n<h3><strong>Add the SDK<\/strong><\/h3>\n<p>Now you will add dependencies for the Firebase messaging.<\/p>\n<p><strong>Refer following steps to add framework:<\/strong><\/p>\n<ul>\n<li>Open your project&#8217;s root directory for the Pod file creation if it is not created yet. Now open <strong>Terminal<\/strong> and go upto your project&#8217;s root directory.<br \/>\nRun command <strong>pod init. <\/strong>It will create a <strong>Podfile<\/strong> for you in the root directory if it is not present.<\/li>\n<li>You can include a Pod in your <strong>Podfile<\/strong> like this:<br \/>\n<b>pod &#8216;Firebase\/Core&#8217;<\/b><b><br \/>\n<\/b> <b>pod &#8216;Firebase\/Messaging&#8217;<\/b><\/li>\n<li>Go back to the terminal and Run command <strong>pod install<\/strong>\u00a0there. It will install all dependencies for Firebase Messaging SDK.<\/li>\n<li>Now Close Terminal and open your xcode <b>.<\/b><b>workspace<\/b> file in your project&#8217;s directory.<br \/>\n<strong>Note:<\/strong> If you open <strong>.xcodeproj<\/strong> file then you won\u2019t get pod dependencies in your project. And, it will throw error that dependency files are not found.<\/li>\n<li>Download a <strong>GoogleService-Info.plist<\/strong> file from <a href=\"https:\/\/console.firebase.google.com\/\">Firebase console<\/a> and include it in your app.<\/li>\n<\/ul>\n<h3><b>Upload your APNs certificates on Firebase<\/b><\/h3>\n<p>To enable sending Push Notifications through APNs, you need:<\/p>\n<ul>\n<li>An Apple Push Notification Certificate for your\u00a0<a href=\"https:\/\/developer.apple.com\/\">Apple Developer account<\/a>.<\/li>\n<li>A <strong>provisioning profile<\/strong> for that App ID.<br \/>\nI am assuming that you already know how to create App Id on the Developer Console.<\/li>\n<\/ul>\n<p>Now steps to <strong>upload\u00a0APNs certificates,<\/strong>\u00a0that you have created with the Push Notification entitlement enabled:<\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Inside your project in the Firebase console, select the gear icon, select <\/span><b>Project Settings<\/b><span style=\"font-weight: 400;\">, and then select the <\/span><b>Cloud Messaging<\/b><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"> tab.<\/span><\/span><\/span><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-3494\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-7.02.44-PM.png\" alt=\"\" width=\"780\" height=\"386\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-7.02.44-PM.png 780w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-7.02.44-PM-300x148.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-7.02.44-PM-768x380.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-7.02.44-PM-624x309.png 624w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/li>\n<\/ul>\n<p>In the cloud Messaging tab, scroll to the bottom, you will found a page like this.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-3495\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-7.06.19-PM.png\" alt=\"\" width=\"931\" height=\"573\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-7.06.19-PM.png 931w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-7.06.19-PM-300x185.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-7.06.19-PM-768x473.png 768w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-7.06.19-PM-624x384.png 624w\" sizes=\"(max-width: 931px) 100vw, 931px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><\/h3>\n<ul>\n<li>Under APNs Certificates, upload your development and the production certificates.You can upload only development file for testing also. On click of Upload, it will open a pop-up as:<img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-3508 size-full\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-2.10.07-PM-1.png\" alt=\"\" width=\"516\" height=\"362\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-2.10.07-PM-1.png 516w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/Screen-Shot-2017-07-10-at-2.10.07-PM-1-300x210.png 300w\" sizes=\"(max-width: 516px) 100vw, 516px\" \/><\/li>\n<\/ul>\n<h3><\/h3>\n<ul>\n<li>Here add your .p12 file and click upload.<br \/>\nNow you are done with the Firebase console. Now all the changes would be done in code.<\/li>\n<\/ul>\n<h3><b>Initialise Firebase in your app<\/b><\/h3>\n<p>Before writing code you need to change settings in Xcode for cloud messaging. In<strong> General -&gt; Capabilities\u00a0<\/strong>enable Push Notifications.<\/p>\n<p>Note: Please ensure that all the steps under this should be enabled. There should not be any red warning against any step, if so, then there is some problem with your App id in which Push Notification was added.<\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Import the <strong>Firebase<\/strong> module in your <\/span><span style=\"font-weight: 400;\"><strong>AppDelegate.swift<\/strong>\u00a0<\/span><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">class:<\/span><\/span>\n<pre class=\"lang:default decode:true \">import Firebase<\/pre>\n<\/li>\n<li><span style=\"font-weight: 400;\">Configure Firebase\u00a0<\/span><span style=\"font-weight: 400;\">shared instance, typically in your application&#8217;s <\/span><strong>application:didFinishLaunchingWithOptions:<\/strong><span style=\"font-weight: 400;\"> method:<\/span>\n<pre class=\"lang:default decode:true \">FIRApp.configure()<\/pre>\n<\/li>\n<\/ul>\n<h3><b>Register for remote notifications<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">You need to register your app on the notification center. For this write the following lines of code:<\/span><\/p>\n<pre class=\"lang:default decode:true\">if #available(iOS 10.0, *) {\r\n            let center = UNUserNotificationCenter.current()\r\n            center.delegate = self\r\n            center.requestAuthorization(options: [.alert,.sound]) { (granted,error)in\r\n                application.registerForRemoteNotifications()\r\n            }\r\n        } else {\r\n            \r\n            let notificationSettings = UIUserNotificationSettings(types: [.alert,.sound], categories: nil)\r\n            application.registerUserNotificationSettings(notificationSettings)\r\n            application.registerForRemoteNotifications()\r\n        }\r\n<\/pre>\n<p>At this point you have registered for push notifications and so you will get the token from APNs in\u00a0<strong><span class=\"s1\">didRegisterForRemoteNotificationsWithDeviceToken: .\u00a0<\/span><\/strong><\/p>\n<p class=\"p1\"><span class=\"s1\">After you call the <strong>registerForRemoteNotifications()<\/strong> method of the <\/span><strong><span class=\"s3\">UIApplication<\/span><\/strong><span class=\"s1\"> object, the app calls this method when device registration completes successfully. In your implementation of this method, connect with your push notification server and give the token to it. APNs pushes notifications only to the device represented by the token.<\/span><\/p>\n<p>Now when you get the APNs token you have to set that token on the Firebase. Your code for this would be like:<\/p>\n<pre class=\"lang:default decode:true \">func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {\r\n        \r\n        \/\/ In debug mode\r\n        FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.sandbox)\r\n        \/\/ In release mode\r\n        FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.prod)\r\n        \r\n    }<\/pre>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">Now for the firebase token you first need to connect to the FCM. For this we make use of NSNotification. For this add the following line of code in <strong>didFinishLaunchingWithOptions:<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">In<\/span><b> AppDelegate.Swift<\/b><span style=\"font-weight: 400;\"> file.<\/span><\/p>\n<pre class=\"lang:default decode:true\">NotificationCenter.default.addObserver(self, selector: #selector(AppDelegate.tokenRefreshNotification), name: NSNotification.Name.firInstanceIDTokenRefresh, object: nil)<\/pre>\n<p><span style=\"font-weight: 400;\">Now whenever token gets refreshed we get the call in <\/span><b>tokenRefreshNotification <\/b><span style=\"font-weight: 400;\">method. It will be like:<\/span><\/p>\n<pre class=\"lang:default decode:true\">func tokenRefreshNotification() {\r\n        \/\/ NOTE: It can be nil here\r\n        let refreshedToken = FIRInstanceID.instanceID().token()\r\n        print(\"InstanceID token: \\(refreshedToken)\")\r\n        connectToFcm()\r\n    }\r\n<\/pre>\n<pre class=\"lang:default decode:true\">func connectToFcm() { \r\n        guard let refreshedToken = FIRInstanceID.instanceID().token() else {\r\n            \/\/ Won't connect since there is no token\r\n            return\r\n        }   \r\n        \/\/ Disconnect previous FCM connection if it exists.\r\n        FIRMessaging.messaging().disconnect()\r\n        \r\n        FIRMessaging.messaging().connect { (error) in\r\n            if (error != nil) {\r\n                print(\"Unable to connect with FCM. \\(error)\")\r\n            } else {\r\n                print(\"Connected to FCM.\")\r\n            }\r\n        }\r\n    }\r\n<\/pre>\n<p>Add the above code in your <strong>AppDelegate.swift.<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">When we get the token it will connect our app to the FCM. In the above method we can also register this token and the required parameters on our local App Server. Now our FCM set up is ready and we\u2019ll get the notification.<\/span><\/p>\n<h3><strong>Handle messages received through the FCM APNs interface<\/strong><\/h3>\n<p>Received messages can be handled in two ways depending on the os version.<\/p>\n<p><span style=\"font-weight: 400;\">Implement <\/span><b>AppDelegate<\/b> <b>application:didReceiveRemoteNotification<\/b><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\">\u00a0for below iOS 10 versions:<\/span><\/p>\n<pre class=\"lang:default decode:true \">func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -&gt; Void) {\r\n        \r\n        if #available(iOS 10.0, *)  {\r\n            \r\n            return\r\n        } else {\r\n            if(application.applicationState == .active){\r\n                \r\n\t\/\/handle foreground state\r\n                \r\n            }\r\n            else{\r\n\/\/handle background state on tap of notification\r\n            }\r\n        }\r\n    }\r\n<\/pre>\n<p>For<span style=\"font-weight: 400;\">\u00a0iOS 10 we can also handle the foreground state for the notification or we get banner in the foreground. For this you need to use <strong>UserNotifications<\/strong> Framework and implement\u00a0<\/span><span class=\"s1\"><strong>UNUserNotificationCenterDelegate<\/strong><\/span><span style=\"font-weight: 400;\">\u00a0methods. Code for this would be:<\/span><\/p>\n<pre class=\"lang:default decode:true\">@available(iOS 10.0, *)\r\n    func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -&gt; Void) {\r\n        completionHandler([.alert, .sound])\r\n        \r\n    }\r\n    \r\n    @available(iOS 10.0, *)\r\n    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -&gt; Void) {\r\n        \r\n        let notif = response.notification.request.content.userInfo\r\n        print(notif)\r\n        \/\/handle data\r\n    }\r\n<\/pre>\n<p>Here you can handle the userInfo that we have received according to project&#8217;s requirement.<\/p>\n<p>That&#8217;s all about FCM Implementation in Swift 3.0.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Firebase Cloud Messaging\u00a0is a free mobile notification service by Google that enables third- party app developers to send notifications from servers to their users. With Firebase Cloud Messaging Service, you can inform a client\u2019s app that a new email or other data is available for sync. It works on the principle of down streaming [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3624,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[71],"tags":[],"class_list":["post-3437","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mobile"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>FCM Implementation in Swift 3.0 - InnovationM - Blog<\/title>\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\/fcm-implementation-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=\"FCM Implementation in Swift 3.0 - InnovationM - Blog\" \/>\n<meta property=\"og:description\" content=\"Introduction Firebase Cloud Messaging\u00a0is a free mobile notification service by Google that enables third- party app developers to send notifications from servers to their users. With Firebase Cloud Messaging Service, you can inform a client\u2019s app that a new email or other data is available for sync. It works on the principle of down streaming [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/\" \/>\n<meta property=\"og:site_name\" content=\"InnovationM - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-08-04T07:50:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/firebase-iOS.png\" \/>\n\t<meta property=\"og:image:width\" content=\"696\" \/>\n\t<meta property=\"og:image:height\" content=\"569\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\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\\\/fcm-implementation-in-swift-3-0\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/fcm-implementation-in-swift-3-0\\\/\"},\"author\":{\"name\":\"InnovationM Admin\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"headline\":\"FCM Implementation in Swift 3.0\",\"datePublished\":\"2017-08-04T07:50:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/fcm-implementation-in-swift-3-0\\\/\"},\"wordCount\":1133,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/fcm-implementation-in-swift-3-0\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/07\\\/firebase-iOS.png\",\"articleSection\":[\"Mobile\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/fcm-implementation-in-swift-3-0\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/fcm-implementation-in-swift-3-0\\\/\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/fcm-implementation-in-swift-3-0\\\/\",\"name\":\"FCM Implementation in Swift 3.0 - InnovationM - Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/fcm-implementation-in-swift-3-0\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/fcm-implementation-in-swift-3-0\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/07\\\/firebase-iOS.png\",\"datePublished\":\"2017-08-04T07:50:17+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/fcm-implementation-in-swift-3-0\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/fcm-implementation-in-swift-3-0\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/fcm-implementation-in-swift-3-0\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/07\\\/firebase-iOS.png\",\"contentUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/07\\\/firebase-iOS.png\",\"width\":696,\"height\":569},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/fcm-implementation-in-swift-3-0\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FCM Implementation 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":"FCM Implementation in Swift 3.0 - InnovationM - Blog","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\/fcm-implementation-in-swift-3-0\/","og_locale":"en_US","og_type":"article","og_title":"FCM Implementation in Swift 3.0 - InnovationM - Blog","og_description":"Introduction Firebase Cloud Messaging\u00a0is a free mobile notification service by Google that enables third- party app developers to send notifications from servers to their users. With Firebase Cloud Messaging Service, you can inform a client\u2019s app that a new email or other data is available for sync. It works on the principle of down streaming [&hellip;]","og_url":"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/","og_site_name":"InnovationM - Blog","article_published_time":"2017-08-04T07:50:17+00:00","og_image":[{"width":696,"height":569,"url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/firebase-iOS.png","type":"image\/png"}],"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\/fcm-implementation-in-swift-3-0\/#article","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/"},"author":{"name":"InnovationM Admin","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"headline":"FCM Implementation in Swift 3.0","datePublished":"2017-08-04T07:50:17+00:00","mainEntityOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/"},"wordCount":1133,"commentCount":0,"image":{"@id":"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/firebase-iOS.png","articleSection":["Mobile"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/","url":"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/","name":"FCM Implementation in Swift 3.0 - InnovationM - Blog","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/#primaryimage"},"image":{"@id":"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/firebase-iOS.png","datePublished":"2017-08-04T07:50:17+00:00","author":{"@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"breadcrumb":{"@id":"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/#primaryimage","url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/firebase-iOS.png","contentUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2017\/07\/firebase-iOS.png","width":696,"height":569},{"@type":"BreadcrumbList","@id":"https:\/\/www.innovationm.com\/blog\/fcm-implementation-in-swift-3-0\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.innovationm.com\/blog\/"},{"@type":"ListItem","position":2,"name":"FCM Implementation 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\/3437","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=3437"}],"version-history":[{"count":0,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/3437\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media\/3624"}],"wp:attachment":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media?parent=3437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/categories?post=3437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/tags?post=3437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}