我正在尝试每天在确切的时间显示通知,但它有时几次射击一小时,或者根本不射击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)
答案 0 :(得分:0)
感谢@LeoDabus,我只添加了一行not.timeZone = TimeZone.default
,现在正在使用