【发布时间】:2012-11-26 03:46:09
【问题描述】:
我正在开发一个 iPhone 应用程序。在这个应用程序中,我使用 AVAudioPlayer 播放音频。 这是我播放声音的代码。
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 上运行应用程序时,出现以下错误,然后应用程序崩溃。
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'
【问题讨论】:
-
那些是奇怪的错误。我建议查看播放器的设置字典,以确定采样率是否正确。
-
我遇到了同样的问题...除了 iPhone5 之外的所有设备都可以工作。你修好了吗?如果(做过)请告诉我~~谢谢~~
标签: iphone objective-c ios