Search code examples
iphonecocoa-touchios4uilocalnotificationlocalnotification

How to set Local Notification repeat interval to custom time interval?


I am making an iPhone app, which has a requirement of Local Notifications.

In local notifications there is repeatInterval property where we can put the unit repeat intervals for mintute, hour, day,week,year, etc.

I want that repeat interval should be 4 hours.

So every 4 hours the local notification comes.

I dont want the user to set seperate notifications for each.

I want the user to be able to set repeatInterval as 4 hours.

How do I do that?


Solution

  • Got the answer, it is as straight as it gets.

    You cannot create custom repeat intervals.

    You have to use on NSCalendarUnit's in-built Unit Time Intervals.

    I tried all the above solutions and even tried other stuffs, but neither of them worked.

    I have invested ample time in finding out that there is no way we can get it to work for custom time intervals.