3
두 개의 탭이있는 TabBarController
이 있는데 두 탭에서 모두 음악을 재생하고 싶습니다. 지금 내가 할 노력하고있어 달성하기 위해 더 나은 방법이 있나요 나는 주요 appDelegate
IOS는 appDelegate에서 AVAudioPlayer를 사용할 수 있습니까?
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"My Song"
ofType:@"m4a"]]; // My Song.m4a
NSError *error;
self.audioPlayer = [[AVAudioPlayer alloc]
initWithContentsOfURL:url
error:&error];
if (error)
{
NSLog(@"Error in audioPlayer: %@",
[error localizedDescription]);
} else {
//audioPlayer.delegate = self;
[audioPlayer prepareToPlay];
}
에 내 코드를 가지고 있지만 UIApplicationMain
에 오류 Program received signal: "SIGABRT"
받고 있어요? 이것이 내가 어떻게해야하는지, 어디에서 문제를 점검하기 시작할 것인가?
나는 당신의 정확한 구현을 사용하지 않았다 이러한 줄을 추가,하지만 난 뽑아 -이 : 파일
appDelegate.m
에서가 할 내가 필요한 조각들을 꺼내. 감사! – Jacksonkr