更新设备时间时不会触发UILocalNotification?

时间:2015-01-28 05:01:35

标签: ios uilocalnotification

在我的应用中,我安排UILocalNotification

当我更改设备时间(通过“设置”)时,UILocalNotifications不会始终激活。有时他们会开火,有时他们不会开火。

没有触发的通知,我仍然可以在UIApplication中的scheduledLocalNotifications下看到它们:

(lldb) po [[UIApplication sharedApplication] scheduledLocalNotifications][0]
<UIConcreteLocalNotification: 0x17434cb80>{
fire date = Saturday, February 21, 2015 at 11:45:52 PM EST, 
time zone = America/New_York (EST) offset -18000, 
repeat interval = 0, 
repeat count = UILocalNotificationInfiniteRepeatCount, 
next fire date = Saturday, February 21, 2015 at 11:45:52 PM EST, 
user info = {
  packageId = 66;
}}

这是我测试设备上的[NSDate date]

(lldb) po [NSDate date]
2015-02-24 04:51:39 +0000

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

日期“2015年2月21日星期六”已根据您手机的日期“2015-02-24 04:51:39 +0000”过去。 如果你想重复它,那么你必须设置UILocalNotification的repeatInterval,它可以采用以下值:

  • NSWeekCalendarUnit
  • NSWeekdayCalendarUnit
  • NSWeekdayOrdinalCalendarUnit
  • NSWeekOfMonthCalendarUnit
  • NSWeekOfYearCalendarUnit
相关问题