每周点燃一次UILocalNotification不起作用

时间:2016-07-09 15:40:11

标签: ios xcode swift uilocalnotification

我试图用一个非常基本的代码每周发出一次通知,但它似乎无效或日志错误(!?),因为这个

let notification = UILocalNotification()

notification.soundName = UILocalNotificationDefaultSoundName
notification.fireDate = NSDate().dateByAddingTimeInterval(10)
notification.alertBody = "New notification"
notification.userInfo = ["foo": "333"]

notification.timeZone = AppConfig.localTimeZone

notification.repeatInterval = .WeekOfMonth
notification.repeatCalendar = NSCalendar.currentCalendar()

UIApplication.sharedApplication().scheduleLocalNotification(notification)

我得到了

<UIConcreteLocalNotification: 0x7ffd33615350> 
{fire date = Saturday 9 July 2016 at 17 h 23 min 20 s Central European Summer Time, 
time zone = Europe/Rome (GMT+2) offset 7200 (Daylight), 
repeat interval = NSCalendarUnitWeekOfMonth, 
repeat count = UILocalNotificationInfiniteRepeatCount, 
next fire date = Saturday 9 July 2016 at 17 h 23 min 20 s Central European Summer Time, 
user info = {
        foo = 333;
}}

并且从未收到通知,但如果我将一天设置为repeatInterval,则会收到通知,但下次开火日期等于开火日期

可以是模拟器问题吗? 感谢

0 个答案:

没有答案