application:didReceiveRemoteNotification:fetchCompletionHandler Not Called application:didReceiveRemoteNotification:fetchCompletionHandler Not Called ios ios

application:didReceiveRemoteNotification:fetchCompletionHandler Not Called


application:didReceiveRemoteNotification:fetchCompletionHandler: gets called even if the app is suspended, not running at all, backgrounded, or active. Also worth noting that the method is iOS 7 only. Here is the apple documentation.

HOWEVER if the app was forcibly closed (i.e. by killing with the app switcher), the app will not be launched. (see SO answer)EDIT: I checked this again on iOS 7.1 to see if they fixed this, but it still remains the case that if the app is killed manually, app will NOT be woken up and application:didReceiveRemoteNotification:fetchCompletionHandler: will not be called

When receiving the push, the app is only woken up only "if needed" to call the application:didReceiveRemoteNotification:fetchCompletionHandler: method (i.e. you have to set the "content-available" flag within the push notification payload. See SO answer). The method will be called again if the user then opens the app by tapping the notification.

EDIT: haven't checked this on iOS 8. Has anyone else?


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {    //Remote Notification Info    NSDictionary * remoteNotifiInfo = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];    //Accept push notification when app is not open    if (remoteNotifiInfo) {       [self application:application didReceiveRemoteNotification: remoteNotifiInfo];    }    return YES;}


The app should be launched even if it is not running. The Apple documentation says:

When this value is present and a push notification arrives on a device, the system sendsthe notification to your app (launching it if needed) and gives it a few moments to process > the notification before displaying anything to the user.(iOS App Programming Guide)

When a push notification arrives, the system displays the notification to the user andlaunches the app in the background (if needed) so that it can call this method.(UIApplicationDelegate Protocol Reference)

Unlike the application:didReceiveRemoteNotification: method, which is called only whenyour app is running, the system calls this method regardless of the state of your app. Ifyour app is suspended or not running, the system wakes up or launches your app and putsit into the background running state before calling the method.(UIApplicationDelegate Protocol Reference)

However when testing with "content-available":1 pushes the app is never launched when it is not running. When the app is suspended it works.

Did you find yourself a solution Wes?