Skip to content

Instantly share code, notes, and snippets.

@drulabs
Last active August 15, 2017 15:52
Show Gist options
  • Save drulabs/7774951b2b13752f477f15e2ad0d30e5 to your computer and use it in GitHub Desktop.
Save drulabs/7774951b2b13752f477f15e2ad0d30e5 to your computer and use it in GitHub Desktop.
Receive data from remote notification
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
print("Dhruw: Dumping notification payload")
if application.applicationState != .active {
let value1: String? = userInfo["key1"] as? String
let value2: String? = userInfo["key2"] as? String
let value3: Bool? = userInfo["key3"] as? Bool
// do something with the received data
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment