objective c - how to detect user clicked iOS remote notification? -


when user taps on remote notification, following callback triggered in app delegate:

-application:didreceiveremotenotification:fetchcompletionhandler:

in scenario, application launched , app state uiapplicationstateactive interpret user actioned on remote notification.

the problem: method can called when remote notification arrives , app in foreground with inactive state.

example: when notification center view open(swipe top edge of screen down) or uialert open. in both case application state uiapplicationstateactive , there no way tell whether it's user actioned notification or system push received.

q: how can determine if didreceiveremotenotification callback response user tapping on remote notification vs arrival of remote notification?

uiapplicationstate state = [application applicationstate];      if (state == uiapplicationstateactive)      {            //when app in foreground , received push notification      }      else if (state == uiapplicationstateinactive)       {           //when app in background , received push notification      } 

also, didfinishlaunchingwithoptions called if app not running , user tapped notification. have not tried can assume can notification details options.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -