我在App Delegate中设置了本地通知使用此方法:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UILocalNotification *notification = [[UILocalNotification alloc]init];
[notification setAlertBody:@"Watch the Latest Episode of CCA-TV"];
[notification setFireDate:[NSDate dateWithTimeIntervalSinceNow:5]];
[notification setTimeZone:[NSTimeZone defaultTimeZone]];
[application setScheduledLocalNotifications:[NSArray arrayWithObject:notification]];
}
Run Code Online (Sandbox Code Playgroud)
当我运行应用程序然后退出它时,我收到一条错误消息:
2014-06-07 11:14:16.663 CCA-TV [735:149070] 试图安排本地通知 {开火日期= 2014年6月7日星期六太平洋夏令时间11:14:21,时区= America/Los_Angeles (PDT)偏移-25200(日光),重复间隔= 0,重复计数= UILocalNotificationInfiniteRepeatCount,下一个开火日期= 2014年6月7日星期六太平洋夏令时间11:14:21,用户信息=(null)} 带警报但尚未收到用户显示警报的许可
如何获得显示警报的必要权限?