- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
概览
UILocalNotification
的现有实例创建通知repeatInterval
设置为 NSWeekdayCalendarUnit
我想做什么
repeatInterval
设置为不重复,问题
repeatInterval
设置为什么常量才能使其不重复?最佳答案
摘自 Apple 文档:
If you assign an calendar unit such as weekly (NSWeekCalendarUnit) or yearly (NSYearCalendarUnit), the system reschedules the notification for delivery at the specified interval. The default value is 0, which means don't repeat.
我假设您想取消具有重复间隔的通知,您可以通过两种方式做到这一点:
第一个选项很简单,使用:
cancelAllLocalNotifications
在您的应用委托(delegate)中。
第二个需要更多的工作。您需要查看待处理的通知(使用 scheduledLocalNotifications
)并取消通知。
为了知道哪些通知将被取消,您可以在设置通知时使用 userInfo
属性。例如,为每个通知设置一个唯一 ID,这样当您取消该通知时,您只需将该 ID 与 scheduledLocalNotifications
数组中的所有 ID 进行比较即可。
关于ios - UILocalNotification - repeatInterval 重置(不重复),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10359024/
我想将重复间隔设置为用户从日期选择器中选择的值。我的应用程序中有倒计时模式类型的日期选择器。如果用户从日期选择器中选择 4 小时 15 分钟,那么我将使用以下代码设置 firedate和闹钟。 [N
好的,所以我看到几篇帖子说你不能设置 UILocalNotification重复多于或少于几个给定的选项(每分钟/小时/天/周/月等)。 但是,这些帖子都没有解决 repeatInterval 的设置
我正在发出本地通知警报 (iOS 5),它将定期(每分钟)重复其提醒,直到用户通过在 UILocalNotification 上设置 repeatInterval 来确认它实例添加到 [[UIAppl
当使用 repeatInteval 时,无论是否设置为分钟/天/小时等,通知都会一个接一个地推送。 它似乎工作正常,直到我每隔几秒测试一次,现在设置不会改回原样。有什么理由吗? var dat
我正在尝试安排重复的本地通知,并将应用程序角标(Badge)编号设置为到目前为止在任何给定时刻安排的实际通知数量。 由于显然无法为每次出现的通知设置不同的角标(Badge)编号,我只能看到 3 种解决
几个星期以来,我一直在为这个问题绞尽脑汁。 如果我将 UILocalNotification 的 repeatInterval 属性设置为非固定间隔会怎样? (非固定是指 NSWeekdayCalen
我想创建具有自定义间隔重复(例如每 20 天)的本地通知。我知道我们有 NSDayCalendarUnit、kCFCalendarUnitMonth ...但我希望将重复间隔设置为 20 天。我不想每
概览 我正在根据 UILocalNotification 的现有实例创建通知 现有实例已将 repeatInterval 设置为 NSWeekdayCalendarUnit 我想做什么 我想将repe
如何将 UILocalNotification 设置为每两天、每三天等重复...?不使用默认的 NSCalendarUnits? 最佳答案 不能重复,两天之内,Localnotification只允许
我正在尝试为一周中特定几天的提醒创建本地通知。 这就是我到目前为止所做的事情 let calender = NSCalendar.currentCalendar() let notif
如果我创建一个UILocalNotification并将其fireDate设置为过去并使用repeatInterval,那么将来下次repeatInterval到期时它会触发吗?或者 UILocalN
我在我的应用程序中安排了一批通知,一些具有重复间隔,另一些只是在特定日期触发一次。我正在使用此方法设置我的通知以创建通知: func notification(date: Date, repeatUn
在 UILocalNotification 中,我们像重复一样使用 NSCalendarUnitMinute ..... 但我在 iOS 10 中找不到 UserNotification doc ..
NSMonthCalendarUnit 的行为如何与 UILocalNotification repeatInterval 完全相关? 查找下个月的同一天? 或 查找 30 天后的日期? 例如:如果我
我是一名优秀的程序员,十分优秀!