How to replace deprecated NSWeekCalendarUnit in context of UILocalNotification?
date, ios, ios7, uilocalnotification
Solution
If you were using NSWeekCalendarUnit to trigger a weekly reminder, replace it with NSCalendarUnitWeekOfYear:
if (days == 7) localNotif.repeatInterval = NSWeekCalendarUnit; // deprecated
if (days == 7) localNotif.repeatInterval = NSCalendarUnitWeekOfYear;
You should find your weekly notification still works correctly.
Apple's documentation should be updated to provide guidance on the appropriate replacement.
Problem
In iOS 7.0 the `NSWeekCalendarUnit` has been deprecated. The documentation says it has to be replaced: Use NSCalendarUnitWeekOfMonth or NSCalendarUnitWeekOfYear, depending on which you mean I am using `NSWeekCalendarUnit` for weekly reminders, which one do I have to pick to get the same meaning? I dont understand the difference between `NSCalendarUnitWeekOfMonth` and `NSCalendarUnitWeekOfYear`. Someone has asked the same question here on SO, without an convincing answer. It quite confusing. `Next week` is in my understanding atomic. Today is `Sun 30 March 2014`. Hence `Next week` will always be `Sun 6 March 2014`. How could that change from a month or year perspective?