3

When my app is in foreground or inactive then upon receiving push notification, I can click on it and the desired action occurs. If I kill the app then upon tapping a notification the app comes to the home screen. Handling Push Notifications when App is Terminated from this post I understood that this is the desired behavior.

I also have 2 actionable buttons attached on my notification. if I click on one of them then I am not redirected to the home screen and the app loads indefinitely! Is there a work around to make the user come to the home screen?

Methods implemented by me which dont get executed after the app is killed and i receive a notification

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler

(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler

(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler 

Also, I read on the posts that after the app is killed and if I click on a notification then didFinishLaunchingWithOptions is executed. I added logger statement in my method but i dont receive them. Any pointers are appreciated.

Community
  • 1
  • 1
A_G
  • 2,260
  • 3
  • 23
  • 56
  • 1
    It will be tough for you to get help with this without revealing some code. – danh Dec 22 '16 at 15:41
  • Whenever I killed the app, my xcode was getting disconnected so couldn't identify if the methods were getting executed! – A_G Dec 23 '16 at 07:15
  • 1
    in iOS 10 with usernotification,if the app is killed and tapping on notificaton in addition to didFinishLaunchingWithOptions didReceiveNotificationResponse method also triggerd.So u dont need to implement notification action logic in didFinishLaunchingWithOptions. – user3608500 Dec 23 '16 at 13:26

0 Answers0