0

I use push notifications but while my app is closed,and push received it is not executed(i perceived by putting break point didreceived method),only appears on screen.What can i do to detect push received while app is closed? I use also background fetch and remote notifications in target->Capabilities

MY Codes :

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)   (UIBackgroundFetchResult))completionHandler {
  • Your app won't be woken up, if it was force-quit by the user, there is no way to achieve this with push notifications at the moment. See [this question](http://stackoverflow.com/questions/19068762/will-ios-launch-my-app-into-the-background-if-it-was-force-quit-by-the-user?lq=1) and [this answer](http://stackoverflow.com/a/31514104/594074). – Baris Akar Jul 21 '15 at 10:23

1 Answers1

1

1) You have to set "content-available" to 1 in the notification body.

2) And have the right background modes: Background Modes

Also: Your users can turn this off by disabling Background App Refresh in the iPhone Settings. You can check this in code:

[UIApplication sharedApplication].backgroundRefreshStatus!=UIBackgroundRefreshStatusAvailable
Nils Ziehn
  • 4,118
  • 6
  • 26
  • 40