iOS set local notification on a specific day

前端 未结 4 1220
终归单人心
终归单人心 2021-01-21 02:17

I am sure this question is duplicated somewhere, but I can\'t find a solution. I am making an app in which one feature allows the user to select the days and times they will rec

4条回答
  •  广开言路
    2021-01-21 03:12

    I know how to set an notification for a certain time in the future, but how do I set a notification for say 6pm on a Monday?

    You can create an NSDate object representing 6pm on the next Monday with the approach showed in How to Get an NSDate for a Specific Day of Week and Time from an Existing NSDate. Then, if you want it to repeat on every Monday you can use localNotification.repeatInterval = NSWeekCalendarUnit. However I'm not sure it's going to work as expected with Daylight saving time.

提交回复
热议问题