Skip to content

Instantly share code, notes, and snippets.

@matzew
Created February 20, 2014 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matzew/9118544 to your computer and use it in GitHub Desktop.
Save matzew/9118544 to your computer and use it in GitHub Desktop.
Wake Up
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
UILocalNotification *notification = [[UILocalNotification alloc]init];
notification.repeatInterval = NSDayCalendarUnit;
[notification setAlertBody:@"Wake up! You lost a billion in stocks already!"];
[notification setFireDate:[NSDate dateWithTimeIntervalSinceNow:1]];
[notification setTimeZone:[NSTimeZone defaultTimeZone]];
[application setScheduledLocalNotifications:[NSArray arrayWithObject:notification]];
completionHandler(UIBackgroundFetchResultNewData);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment