Iphone 警报操作未显示
我有我的通知,但由于某种原因,它仍然没有显示为警报视图 这是:Iphone 警报操作未显示,iphone,objective-c,uilocalnotification,Iphone,Objective C,Uilocalnotification,我有我的通知,但由于某种原因,它仍然没有显示为警报视图 这是: - (void)applicationDidEnterBackground:(UIApplication *)application { UIApplication *app = [UIApplication sharedApplication]; UILocalNotification *notification = [[UILocalNotification alloc] init]; if (notif
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UIApplication *app = [UIApplication sharedApplication];
UILocalNotification *notification = [[UILocalNotification alloc] init];
if (notification) {
notification.fireDate = [NSDate dateWithTimeIntervalSinceNow:5];
notification.timeZone = [NSTimeZone defaultTimeZone];
notification.alertBody = @"Notification";
notification.alertAction = @"View";
[app scheduleLocalNotification:notification];
}
如果您希望以UIAlertView而不是横幅形式查看本地通知,则必须在实际设备上测试应用程序,并在“设置”中更改应用程序的通知“警报样式”。正如您所说,由于模拟器的设置中没有“通知”选项,因此它将始终默认为横幅。您是否在应用程序启动后5秒内退出?警报只会在你不在应用程序中时显示。是的,我确实这样做了。它以bannerOh的形式出现,那么你只需在设备设置中设置它,以显示警报而不是横幅。它在模拟器中,没有通知设置