Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // AppDelegate.m
- - (void)deleteNotif:(id)sender{
- NSCalendar *calendarDeleteNotif = [NSCalendar currentCalendar];
- NSDateComponents *dateCompsDeleteNotif = [calendarDeleteNotif components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:[NSDate date]];
- [dateCompsDeleteNotif setSecond:0.5];
- if ([NSDate date] == dateCompsDeleteNotif) {
- [[UIApplication sharedApplication] cancelAllLocalNotifications];
- [self deleteNotif:(id)self];
- NSLog(@"NSLog: cancelAllLocalNotifications done");
- }
- }
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
- [self deleteNotif:(id)self];
- }
- - (void)applicationDidEnterBackground:(UIApplication *)application{
- [self deleteNotif:(id)self];
- }
- - (void)applicationWillTerminate:(UIApplication *)application{
- [self deleteNotif:(id)self];
- }
- // End of code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement