I am implementing background refresh in my app. To test the app I have this in my AppDelegate.m:
-(void)application:(UIApplication *)application
performFetchWithCompletionHandler:
(void (^)(UIBackgroundFetchResult))completionHandler {
NSLog(@"did a background refresh");
completionHandler(UIBackgroundFetchResultNewData);
}
I tested it on the simulator and it works fine. I am unsure of what the use of completionHandler(UIBackgroundFetchResultNewData);
Why do I need to call this and what can I use it for? I understand that it can be:
UIBackgroundFetchResult.NewData - Called when new content has been fetched, and the application has been updated.
UIBackgroundFetchResult.NoData - Called when the fetch for new content went through, but no content is available.
UIBackgroundFetchResult.Failed - Useful for error handling, this is called when the fetch was unable to go through.
However I don't understand why I have to call it and how it's useful. Any pointers on this would be really appreciated. Thanks!