use*_*037 2 ios uilocalnotification
概观
UILocalNotification
repeatInterval
设置为NSWeekdayCalendarUnit
我想做的事
repeatInterval
重复,题
repeatInterval
为了不重复,我应该设定的常数是多少?取自Apple文档:
如果您指定日历单位(例如每周(NSWeekCalendarUnit)或每年(NSYearCalendarUnit)),系统将按指定的时间间隔重新安排通知以进行交付.默认值为0,表示不重复.
我假设您要以重复间隔取消通知,您可以通过两种方式执行此操作:
第一个选项很简单,使用:
cancelAllLocalNotifications
Run Code Online (Sandbox Code Playgroud)
在您的应用代表中.
第二个需要更多的工作.您需要浏览待处理的通知(使用scheduledLocalNotifications
)并取消通知.
为了知道要取消哪些通知,您可以userInfo
在设置通知时使用该属性.例如,为每个通知设置唯一ID,因此当您取消该通知时,只需将该ID与scheduledLocalNotifications
阵列中的所有ID进行比较即可.