오디오에서 처음으로 작업. 무언가를 놓치 실 수도 있습니다.재생시 AVAudioPlayer가 충돌 함
AVFoundation 프레임 워크를 추가했습니다. #import
을 추가하고 이것을 viewDidLoad에 추가했습니다.
NSString* docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString* audioPath = [docPath stringByAppendingPathComponent:@"001.mp3"];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:audioPath];
if (!fileExists) {
NSLog(@"Audio File not exist!");
}else{
NSError *error;
NSURL *url = [[NSURL alloc] initFileURLWithPath:audioPath];
NSData *audioData = [NSData dataWithContentsOfURL:url];
self.audioPlayer = [AVAudioPlayer alloc];
// It crashes at this line
self.audioPlayer = [self.audioPlayer initWithData:audioData error:&error];
NSLog(@"%@",self.audioPlayer);
}
어떤 메시지가 표시되면 다운 되나요? – zoul
출력에만이 출력 (lldb) – Mani