Waqas
Waqas

Reputation: 35

Local Notification 15 Minute Interval Issue

I am trying to embed local notification in my code which i want to get repeat after every 15 minutes. It takes NsCalendarUnit and i am unable to figure out as in how to convert 15 mints into NSCalendarUnit

UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:30];
localNotification.repeatInterval = 900.0;
localNotification.alertBody = @"Your alert message";
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];       

Upvotes: 0

Views: 79

Answers (1)

rckoenes
rckoenes

Reputation: 69459

The repeatInterval is not a time, it an value of NSCalendarUnit.

This means you can NOT set the interval to 15 min.

You best option is to use 4 notification with a repeatInterval of NSCalendarUnitHour and set them 15 minutes apart.

Upvotes: 1

Related Questions