我不是讓聲音在這裏獲取的音頻文件是我的代碼如何從項目iphone
NSString *filepath=[[NSBundle mainBundle]pathForResource:@"horror (2)" ofType:@"mp3" ];
NSLog(@"filepath=%@",filepath);
url=[[NSURL alloc]initFileURLWithPath:filepath ];
NSLog(@"url==%@",url);
audioplayer=[[AVAudioPlayer alloc]initWithContentsOfURL:url error:nil ];
[self.audioplayer prepareToPlay];
self.audioplayer.currentTime=0;
[self.audioplayer play];
audioplayer.numberOfLoops=-1;
如果用'NSError *'的地址替換'nil'的錯誤信息,然後打印出可能導致錯誤的詳細信息,會發生什麼? –
你的日誌語句顯示什麼? –