当应用程序位于使用ios 8的前台时,Scheduler UILocalNotification无效

时间:2015-09-04 06:21:20

标签: ios objective-c ios8 uilocalnotification

UILocalNotification未触发当应用程序处于前台模式时,但相同的代码在应用程序位于后台时工作正常,从应用程序获取的日志中获取此信息的用户信息始终为空在前台模式。

  

火灾日期= 2015年9月4日星期五下午6:28:37印度标准   时间,时区=亚洲/加尔各答(格林尼治标准时间+5:30)抵消19800,重复   interval = 0,repeat count = UILocalNotificationInfiniteRepeatCount,   next fire date =(null),user info =(null)

请检查此示例代码我在我的应用程序example code

中使用此代码

1 个答案:

答案 0 :(得分:1)

您是否在点火通知时设置了UserInfo?在示例代码中,它是nil。检查我已设置userinfo = andInfo:@{@"a":@"ab"}

[[MKLocalNotificationsScheduler sharedInstance] scheduleNotificationOn:[NSDate dateWithTimeIntervalSinceNow:10]
                                                                  text:@"Hey there" 
                                                                action:@"View" 
                                                                 sound:nil 
                                                           launchImage:nil 
                                                               andInfo:@{@"a":@"ab"}];

并在Log i中获取

  

收到:{消防日期= 2015年9月4日星期五下午12:25:44印度标准时间,时区=亚洲/加尔各答(格林威治标准时间+5:30)偏移19800,重复间隔= 0,重复计数= UILocalNotificationInfiniteRepeatCount,下一个开火日期=(null),用户信息= {       a = ab;   }}