Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

erdinc27

macrumors regular
Original poster
Jul 20, 2011
168
1
In the application, I give users some options to set UILocalNotification repeat interval(e.g 5 min, 10 min, 20 min 40 min, 1 hour, 2 hours, 1 day). The problem I face is that when I set the notification it fires the first notification on time but the rest notifications are fired 1 minute in a row. Here the code I use,

Code:
UILocalNotification *notification = [[UILocalNotification alloc] init];
NSDate *fireTime = [[NSDate date] dateByAddingTimeInterval:self.selectedFrequency];
notification.fireDate = fireTime;
notification.repeatInterval = NSCalendarUnitSecond;
notification.timeZone = [NSTimeZone defaultTimeZone];
notification.applicationIconBadgeNumber += 1;
notification.alertBody = @"Notification Fired";
notification.soundName = @"sound.m4r";
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];

How can I set UILocalNotification for the certain period?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.