You can use the application:didReceiveRemoteNotification:fetchCompletionHandler:
inside your AppDelegate.m
. This way you can handle the notification the way you want. Sometimes its not needed to show anything inside an UIAlertView
but you want to update specific UILabels
or what ever. You also get a userInfo
where you can get more specific information about your Push
. You can also identify in which mode you're at the moment:
if ( application.applicationState == UIApplicationStateInactive
|| application.applicationState == UIApplicationStateBackground ) {
} else {
}
The Documentation says:
Use this method to process incoming remote notifications for your app.
Unlike the application:didReceiveRemoteNotification: method, which is
called only when your app is running in the foreground, the system
calls this method when your app is running in the foreground or
background. In addition, if you enabled the remote notifications
background mode, the system launches your app (or wakes it from the
suspended state) and puts it in the background state when a push
notification arrives. However, the system does not automatically
launch your app if the user has force-quit it. In that situation, the
user must relaunch your app or restart the device before the system
attempts to launch your app automatically again.