When the server is delivering notifications to the client, the client has several things:
1. The application is turned off and the notification is displayed, either by tapping the app icon or by clicking the notification, the system launches the app and invokes its proxy method (application:didfinishlaunchingwithoptions:), Deliver notifications via Launchoptions.
if (launchoptions) {
nsdictionary* Pushnotificationkey = [Launchoptions Objectforkey:uiapplicationlaunchoptionsremotenotificationkey];
if (Pushnotificationkey) {
Define your own way of handling this.
}
}
2. The application is in a background state, when the notification is displayed. If you click on the notification, the app calls Application:didreceiveremotenotification: Method or Application:didreceivelocalnotification: method, if you click the Apply icon , the method above is not automatically executed.
3. The application is in a foreground state when the notification is not displayed. the application calls directly (because the app is in the foreground) its proxy function Application:didreceiveremotenotification: method or Application:didreceivelocalnotification: Method that conveys the notification object for the response.
Questions about the iOS Push notification response