嗨,我正在使用闹钟应用程序,并设置LocalNotifications
闹钟音乐之类的铃声。我完美地播放铃声。但问题是在 AlertView 中单击“确定”按钮后,铃声正在播放。我怎样才能玩立即接收LocalNotification
。
我正在使用以下代码播放铃声:
-(void)application:(UIApplication *)application
didReceiveLocalNotification:(UILocalNotification *)notification
{
application.applicationIconBadgeNumber = 0;
NSString *reminderText = [notification.userInfo objectForKey:kRemindMeNotificationDataKey];
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/Mitwa.mp3", [[NSBundle mainBundle] resourcePath]]];
NSError *error;
player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
player.numberOfLoops = -1;
if (player == nil)
NSLog([error description]);
else
[player play];
[viewController showReminder:@"Good Evening Mahesh!"];
}
请帮我在收到通知后播放警报。
谢谢...