AVAudioPlayer在iPhone 5中不起作用 [英] AVAudioPlayer is not working in iPhone 5
本文介绍了AVAudioPlayer在iPhone 5中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个iPhone应用程序.在此应用程序中,我正在使用AVAudioPlayer播放音频.这是我播放声音的代码.
I am developing an iPhone application.In this app i am using AVAudioPlayer for playing audio. This is my code for playing the sound.
NSString* resourcePath = [[NSBundle mainBundle] resourcePath];
resourcePath = [resourcePath stringByAppendingString:@"/sound.mp3"];
NSError* err;
player_ = [[AVAudioPlayer alloc] initWithContentsOfURL:
[NSURL fileURLWithPath:resourcePath] error:&err];
if( err )
{
}
else
{
[player_ prepareToPlay];
[player_ play];
int playingLoops = 0;
player_.numberOfLoops = playingLoops;
}
在除iPhone5以外的其他iPhone设备上都可以正常工作.虽然我在iPhone 5上运行该应用程序,但出现以下错误,然后应用程序崩溃了.
It is woking fine on iphone devices except iPhone5.While i run the app on iPhone 5 i get following error then app crashes.
2012-11-26 09:02:28.484 test[728:1dd03] <0xb0081000> Error '!obj' trying to fetch default input device's sample rate
2012-11-26 09:02:28.484 test[728:1dd03] <0xb0081000> Error getting audio input device sample rate: '!obj'
2012-11-26 09:02:28.494 test[728:1dd03] <0xb0081000> AQMEIOManager::FindIOUnit: error '!dev'
推荐答案
我也遇到了相同的问题,并给出了相同的错误.当尝试解决此问题时,我注意到代码中没有问题.我们需要更新媒体播放器或安装Flash Player,一切正常.
I was also facing same problem giving the same error. when try to solve this problem i notice that there is no problem in code. we need to update media player or install flash player and it's work fine.
这篇关于AVAudioPlayer在iPhone 5中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文