Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)applicationDidEnterBackground:(UIApplication *)application
- {
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
- (UIApplication *)application;
- {
- NSDate *alertTime = [[NSDate date]
- dateByAddingTimeInterval:10];
- UIApplication* app = [UIApplication sharedApplication];
- UILocalNotification* notifyAlarm = [[UILocalNotification alloc]
- init];
- if (notifyAlarm)
- {
- notifyAlarm.fireDate = alertTime;
- notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
- notifyAlarm.repeatInterval = 0;
- notifyAlarm.soundName = @"Ping.aiff";
- notifyAlarm.alertBody = @"Message Test..";
- [app scheduleLocalNotification:notifyAlarm];
- }
- }
- }
- NSDateComponents *comps = [[NSDateComponents alloc] init];
- [comps setDay:28];
- [comps setMonth:9];
- [comps setYear:2012];
- [comps setHour:17];
- [comps setMinute:30];
- NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
- NSDate *fireDate = [gregorian dateFromComponents:comps];
- // Setup local notification
- UILocalNotification *alarm = [[UILocalNotification alloc] init];
- //... set the message, repeat interval, sound etc.
- alarm.fireDate = fireDate;
- alarm.repeatInterval = NSWeekCalendarUnit;
- // Schedule the notification
- [[UIApplication sharedApplication] scheduleLocalNotification:alarm];
Add Comment
Please, Sign In to add comment