0

I need to fire a local notification which is decided by the end user.

I provide 8/9 options to the user for selecting at least one of below time duration. 20 minutes , 25 minutes till 60 minutes.

Again user provides the starting time.

Consider the time duration is morning 6.28 to night 11.37

The expected tasks performed by the local notification is

show a local notification after every 20 minutes between the duration of 6.28 am to 11.37 pm.

first notification will come at 6.48 am. And till its 11.37 . No notification should come after 11.37.

Is there any way ?

Dipesh Pokhrel
  • 386
  • 5
  • 20

2 Answers2

1

UILocalNotification has a repeatInterval property which you'd normally use to create recurring notifications. Unfortunately, it does not offer the flexibility you need - you can use repeat intervals of 1 minute, 1 hour, but nothing in between. And there's also no 'end date' option.

The only other option is to create multiple notifications, each firing only once. Keep in mind that there is a maximum of 64 notifications per app. With a minimum interval of 20 minutes, this covers 21 hours and 20 minutes of notifications.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
  • Thanks. I was thinking to create a another notification adding 20 mins to the current time. I have one question in mind how snoozing of alarm clock works. May be that idea will help me to achieve my need – Dipesh Pokhrel Jul 09 '15 at 11:55
  • Found the solution. I ll cancel all the notification and reschedule them once I get the any local notification. – Dipesh Pokhrel Jul 13 '15 at 06:59
-1

UILocalNotification has repeatInterval property.

UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.repeatInterval = NSMinuteCalendarUnit;

Try above code.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Nilesh K
  • 11
  • 3