【发布时间】:2016-07-27 19:31:11
【问题描述】:
我试图在每天的准确时间显示通知,但它有时会在一个小时内触发几次,或者根本不触发 0_o
let not = UILocalNotification()
not.soundName = UILocalNotificationDefaultSoundName
not.alertBody = "Time to stop drink!"
not.fireDate = Calendar.current.date(bySettingHour: HOUR, minute: MINUTE, second: 0, of: Date(), options: Calendar.Options())
not.repeatInterval = Calendar.Unit.day
UIApplication.shared().scheduleLocalNotification(not)
【问题讨论】:
-
您需要将localNotification时区设置为当前时区。不要忘记取消之前安排的通知。
-
@LeoDabus 现在似乎可以工作了,谢谢
标签: ios uilocalnotification swift3