-1

Here are my problems :

  1. Schedule local notifications between two dates every specific day of the week . example : between march 1 and march 20 every sunday

  2. I have more than 64 local notifications to set which is the limit .

    For the first problem i know there is repeatIntervals which i can set to fire notification every Sunday but how can i set them between two dates ? Do i need to calculate manually and find all the Sundays between March 1 and 20 and then set it or there is something better ?

Community
  • 1
  • 1
Aerox
  • 353
  • 3
  • 13
  • http://stackoverflow.com/questions/4363847/how-to-set-local-notification-repeat-interval-to-custom-time-interval – Nitin Gohel Mar 08 '16 at 11:36
  • im afraid that doesnt answer my question. @NitinGohel – Aerox Mar 08 '16 at 11:42
  • From iOS 8, apple increased the local notification limit to more than 300. so you can schedule it once. – RJV Kumar Mar 08 '16 at 12:05
  • Other solution is- you can save the end date(sunday) to userInfo and compare whenever you are receiving the local notification to cancel local notification. – RJV Kumar Mar 08 '16 at 12:07
  • would you please provide the source ? according to this document [link](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/WhatAreRemoteNotif.html) it is still limited to 64 . and i didnt get your other solution . can you explain more ? @RJVKumar – Aerox Mar 08 '16 at 14:44
  • I didn't have the idea about documentation link. But I have tested with more than 64 notifications, all the notifications are fired. Test it once and confirm. – RJV Kumar Mar 09 '16 at 07:30
  • Other solution(repeat intervals)-set the repeat interval on the first sunday and store the end date in userInfo dictionary. Whenever you are receiving the notification compare the system date with end date. If matching, just cancel that notification(future notification should not fire). – RJV Kumar Mar 09 '16 at 07:36
  • yes that should work . thank you Kumar @RJVKumar – Aerox Mar 09 '16 at 10:33

1 Answers1

3

Use the NSCalendar to get the specific dates, put in an array, and pass to the scheduleLocalNotification.

In this topic you can have a sample code of how to do it.

Community
  • 1
  • 1
Ulysses
  • 2,281
  • 1
  • 16
  • 24
  • thank you . but i have two dates . is there anyway to get all the Sunday dates between March 1 and March 20 ? – Aerox Mar 08 '16 at 11:51
  • Yes, you can, check (also appended to the post) http://stackoverflow.com/questions/20823725/objective-c-ios-get-date-for-specific-day-in-week-sunday – Ulysses Mar 08 '16 at 11:59