在我的应用程序中,我正在使用警报功能。它工作正常,但是当我在模拟器中测试时,弹出框会通知警报。在真实设备中,它只是作为状态栏中的通知而不是弹出框。
我正在寻找真实设备中的弹出框。我不确定我在这里做错了什么?
我正在将此代码用于我的警报
[[UIApplication sharedApplication] cancelAllLocalNotifications];
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = date;
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.alertBody = alarmMessage;
localNotification.alertAction = NSLocalizedString(@"View", nil);
localNotification.repeatInterval = NSDayCalendarUnit;
/* Here we set notification sound and badge on the app's icon "-1"
means that number indicator on the badge will be decreased by one
- so there will be no badge on the icon */
NSString *ringtonename = [lblRingToneName text];
NSString *extension = @".caf";
NSString *ringtone = [[NSString alloc]initWithFormat:@"%@%@", ringtonename, extension];
localNotification.soundName = ringtone;
localNotification.applicationIconBadgeNumber = -1;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
谢谢你们的帮助