Advertise here

Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

UILocalNotification custom repeat interval

erdinc27erdinc27 TurkeyPosts: 396Registered Users @ @
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,
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?


Sign In or Register to comment.