Skip to content

Instantly share code, notes, and snippets.

@brandhill
Last active February 18, 2017 03:57
Show Gist options
  • Select an option

  • Save brandhill/2f36f089aba3d33ba7688250cf77faed to your computer and use it in GitHub Desktop.

Select an option

Save brandhill/2f36f089aba3d33ba7688250cf77faed to your computer and use it in GitHub Desktop.
-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
// Call or write any code necessary to get new data, process it and update the UI.
// The logic for informing iOS about the fetch results in plain language:
if (/** NEW DATA EXISTS AND WAS SUCCESSFULLY PROCESSED **/) {
completionHandler(UIBackgroundFetchResultNewData);
}
if (/** NO NEW DATA EXISTS **/) {
completionHandler(UIBackgroundFetchResultNoData);
}
if (/** ANY ERROR OCCURS **/) {
completionHandler(UIBackgroundFetchResultFailed);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment