最佳答案
我已经在应用程序代理中设置了本地通知,使用如下:
- (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]];
}
当我运行应用程序,然后退出它,我收到一个错误说:
2014-06-0711:14:16.663 CCA-TV [735:149070] 尝试安排本地通知{ fire Date = Saturday,June 7,2014 at 11:14:21 UTC-7,time Zone = America/Los _ Angeles (PDT)偏移量 -25200(Daylight) ,重复 间隔 = 0,重复计数 = UILocalNotificationInfiniteRepateCount, 下一个火灾日期 = 2014年6月7日,星期六,太平洋夏令时11:14:21 Time,user info = (null)} < strong > 带有警报但尚未收到 允许用户显示警报
如何获得显示警报所需的权限?