Skip to content

Instantly share code, notes, and snippets.

@ITechRoof
Created March 10, 2020 06:37
Show Gist options
  • Save ITechRoof/9924a8ed716565dbc82e709b3206dacb to your computer and use it in GitHub Desktop.
Save ITechRoof/9924a8ed716565dbc82e709b3206dacb to your computer and use it in GitHub Desktop.
Receive notification
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
NSLog(@"Notification received");
completionHandler(UIBackgroundFetchResultNewData);
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions result))completionHandler {
NSLog(@"Foreground: Notification received");
completionHandler(UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionSound + UNNotificationPresentationOptionBadge);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment