I'm realy confused about this subject, my question is simple: when the application: didReceiveRemoteNotification: fetchCompletionHandler:
will be called?
if the application is running and in foreground ? i test and the response is yes for iOS 7 and no in iOS 6 as described in the function comment.
if the application is in background and running ? response: same as 1.
if the application is in background but suspended by the system ?
most importent point: if the application is killed (not in the "multitask view")?
how i activate/handel the notification :
- add the remote motif in xcode capabilities section (in info.plist).
- ask to register :
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeNewsstandContentAvailability]
3 . implement the delegate method. (add inside completionHandler(UIBackgroundFetchResultNewData);
)
when i send a notification (with the content-available key==1) :
- if the app is in foreground/background and running the function is triggered and the code inside is performed (i download an image and save it in documents folder).
- if the app is killed, the image is not downloaded.
second question : have you any easy why to debug remote notification background mode?
[edit]
after tests, if the app is suspended (we add a loop to log date) it receive the notification and try to trigger code, but the app is stopped after 1 seconde, have we miss a parameter to encase duration ? (as i read the maximum is 30 secondes).