안녕하세요. 알람 응용 프로그램과 함께 작동하고 벨소리와 비슷한 알람 음악을 설정하여 LocalNotifications
입니다. 나는 벨소리를 완벽하게 연주했다. 그러나 문제는 AlertView에서 "확인"버튼을 클릭 한 후입니다. 벨소리가 재생 중입니다. 즉시 재생하여 LocalNotification
을 수신하려면 어떻게해야합니까? 나는 벨소리를 재생하려면 다음 코드를 사용하고iPhone 앱에서 알람 음악을 재생하는 방법은 무엇입니까?
:
-(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!"];
}
는 통지를받은 후 알람을 재생 제발 도와주세요.
감사합니다 ...
@ Augustine93 .. 감사합니다. "알림을 올 때"자동으로 "앱을 여는 방법"을 알려주시겠습니까? 자동으로 열 수 있습니까? –
나중에 @Mahesh가 열립니다. –