AVAudioPlayer iOS错误 [英] AVAudioPlayer iOS Error
本文介绍了AVAudioPlayer iOS错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试使用AVAudioPlayer播放剪辑时出现错误.该错误给了我:
I get an error trying to play a clip using AVAudioPlayer. The error gives me:
操作无法完成. (OSStatus错误-50.)'
'The operation couldn’t be completed. (OSStatus error -50.)'
我不知道.框架都在那里等等...
I have no idea. The frameworks are all there etc...
与URL有关吗?
这是我的代码:
NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"grunt" ofType:@"aiff"];
NSURL *fileURL = [NSURL URLWithString:soundFilePath];
NSError *error;
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:&error];
if(!error){
audioPlayer.delegate = self;
[audioPlayer play];
}else{
NSLog(@"Error loading clip: %@", [error localizedDescription]);
}
提前谢谢!
推荐答案
have you tried NSURL +fileURLWithPath?
这篇关于AVAudioPlayer iOS错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文