Perhaps I am wrong, but to me it does not really make sense to add that if around the 'content-available' (it's not only for background processing; newsstand leverages that as well).
However, I don't mind adding the two methods, but please let's not add check around 'content-available'. The passed 'completionHandler' block needs to be only invoked, when the app is in the background - not on the foreground. The above code does not differentiate that, it just checks on 'content-available'. Note: it is valid that an app in foreground receives a message that states 'content-available':1, but in that case calling the passed in 'completionHandler'-block is wrong.
Really, this block should be only invoked when performing background processing. The meaning here is really to signal if a concurrent download of additional data for the push notification' was successful (or not).
PErhaps we might need something like this:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
if (application.applicationState == UIApplicationStateBackground) {
// perform tasks that are best suited for background processing,
// such as download data that is related to the push notification
...
// afterwards it is required to invoke the given block:
completionHandler(UIBackgroundFetchResultNewData); // download of data did succeed
} else {
// foreground .....
[self application:application didReceiveRemoteNotification:userInfo];
}
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
///some other code.......
}
and calling the 'application:didReceiveRemoteNotification' for the foreground case, but NOT because of the app is
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Perhaps I am wrong, but to me it does not really make sense to add that if around the 'content-available' (it's not only for background processing; newsstand leverages that as well).
However, I don't mind adding the two methods, but please let's not add check around 'content-available'. The passed 'completionHandler' block needs to be only invoked, when the app is in the background - not on the foreground. The above code does not differentiate that, it just checks on 'content-available'. Note: it is valid that an app in foreground receives a message that states 'content-available':1, but in that case calling the passed in 'completionHandler'-block is wrong.
Really, this block should be only invoked when performing background processing. The meaning here is really to signal if a concurrent download of additional data for the push notification' was successful (or not).
PErhaps we might need something like this:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { if (application.applicationState == UIApplicationStateBackground) { // perform tasks that are best suited for background processing, // such as download data that is related to the push notification ... // afterwards it is required to invoke the given block: completionHandler(UIBackgroundFetchResultNewData); // download of data did succeed } else { // foreground ..... [self application:application didReceiveRemoteNotification:userInfo]; } } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { ///some other code....... }and calling the 'application:didReceiveRemoteNotification' for the foreground case, but NOT because of the app is