Search code examples
iosnsdatensdateformatteruilocalnotificationnscalendar

Multiple local notifications in iOS


I am making an iOS App that will remind the patient to take medicine on scheduled time. For example, user will choose start date and end date and also number of times in a day (at 9:00 am, 1:00 pm etc). Also user can choose intervals between days or choose a weekdays to take medicine. For example, only on MON and TUE.

Is there any third party class that may help me to get list of dates based on parameters passed ?

Also, I have read somewhere that we can schedule only 64 local notifications at a time. In my case, user can choose start date and end date which might result in days more than 64.

How would I manage it ? I don't have any clue on these things.


Solution

  • Apple Doc says:

    Each app on a device is limited to 64 scheduled local notifications. The system discards scheduled notifications in excess of this limit, keeping only the 64 notifications that will fire the soonest. Recurring notifications are treated as a single notification.

    Manage your notifications intelligently. Then It should not be a problem. Try to generate up to 64 notification through whole day and set repeatInterval of UILocalNotification to NSCalendarUnitDay. I guess it will help.