Difference between NSCalendarUnitWeekOfYear & NSCalendarUnitWeekOfMonth

后端 未结 2 1318
暖寄归人
暖寄归人 2020-12-18 23:47

I want to make a UILocalNotification repeat every week, before iOS7 I would use localNotification.repeatInterval = NSWeekCalendarUnit - except

2条回答
  •  别那么骄傲
    2020-12-19 00:19

    As for the UILocalNotification

    NSCalendarUnitWeekOfYear should be used as a unit for repeatInterval.

    When I set repeatInterval = NSCalendarUnitWeekOfMonth for the notification scheduled 10 seconds from now, the notification doesn't fire, and the description of the instance of UILocalNotification prints .. next fire date = (null) ...

    If I use NSCalendarUnitWeekOfYear then notification appears and I see correct next fire date from code in the notification's description.

提交回复
热议问题