I want to create a UILocalNotification
(a location notification reminder) which will run with a periodic time interval. For example if I create a local reminder with time say 2013-12-12 12:00:00
and if I set the time interval with 5 minute then this local reminder should notify me every 5 minutes from scheduled time.
Asked
Active
Viewed 282 times
-1
-
Have you tried NSTimer? – Lior Pollak Oct 14 '13 at 14:26
-
possible duplicate of [UILocalNotification Repeat Interval for Custom Alarm (sun, mon, tue, wed, thu, fri, sat)](http://stackoverflow.com/questions/6966365/uilocalnotification-repeat-interval-for-custom-alarm-sun-mon-tue-wed-thu-f) – rckoenes Oct 14 '13 at 14:47
1 Answers
0
UILocalNotification
does not have any option to set a time interval for every 5 minutes. You can only specify a NSCalendarUnit
for the repeatInterval
property.
The best option is to make several UILocalNotification
every 5 min. past the reminder and set the repeatInterval
on NSHourCalendarUnit
to make them repeat every hour.
repeatInterval
documentation:
If you assign a calendar unit such as weekly (NSWeekCalendarUnit) or yearly (NSYearCalendarUnit), the system reschedules the notification for delivery at the specified interval. The default value is 0, which means don't repeat.

MZimmerman6
- 8,445
- 10
- 40
- 70

rckoenes
- 69,092
- 8
- 134
- 166
-
So it should be notification.repeatInterval = 5*NSMinuteCalendarUnit, right? – Lior Pollak Oct 14 '13 at 14:40
-
No, you can **NOT** set a custom `repeatInterval` only values from the `NSCalendarUnit` are accepted. – rckoenes Oct 14 '13 at 14:41
-
In the Apple iOS documentation linked in my answer and many other answer to this same question on stackoverflow: http://stackoverflow.com/questions/6966365/uilocalnotification-repeat-interval-for-custom-alarm-sun-mon-tue-wed-thu-f – rckoenes Oct 14 '13 at 14:46
-
Nor is it stated that it will work, the type of the property says it all: `NSCalendarUnit` not `NSTimeInterval`! – rckoenes Oct 14 '13 at 14:48