こんにちは私はアラームアプリケーションを使用していて、LocalNotifications
着信音のようなアラーム音楽を設定しています。着メロを完璧に弾いています。しかし、問題は、AlertViewの[OK]ボタンをクリックした後、着信音が再生されていることです。すぐにプレイして受け取るにはどうすればよいですか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!"];
}
通知を受け取った後、アラームを鳴らすのを手伝ってください。
ありがとう...