以下问题:
<0xb03e7000> Error '!obj' trying to fetch default input device's sample rate <0xb03e7000> Error getting audio input device sample rate: '!obj' <0xb03e7000> AQMEIOManager::FindIOUnit: error '!dev'我已经在stackoverflow上找到了这个问题,但是没有一个 提供的解决方案对我有用.
I found this problem already here on stackoverflow but none of the provided solutions worked for me.
代码:
#import "CJTActionViewController.h" @interface CJTActionViewController() @property NSURL *url; @property NSData *songFile; @property AVAudioPlayer *audioPlayer; @end @implementation CJTActionViewController - (void)viewDidLoad { [super viewDidLoad]; self.url = [NSURL fileURLWithPath: [NSString stringWithFormat:@"%@/cannon_01.wav", [[NSBundle mainBundle] resourcePath]]]; self.songFile = [[NSData alloc] initWithContentsOfURL:self.url]; self.audioPlayer = [[AVAudioPlayer alloc] initWithData:self.songFile error:nil]; self.audioPlayer.delegate = self; self.audioPlayer.numberOfLoops = 0; } - (IBAction)firePressed(id):sender { [self.audioPlayer play]; } @end代表已设置.不知道它是否重要,但是在另一台Mac上 代码运行没有问题.
Delegate is set. Dont know if its important but on another mac this code runs without problems.
我使用ios 6.1和模拟器6.1
I use ios 6.1 and simulator 6.1
推荐答案我遇到了同样的问题,并且能够根据此问题的答案.我使用的是外部声卡,并且通过以下方式更改了Mac上的音频设置就可以了:
I had this same problem, and was able to fix it by adjusting the sound settings on the mac I am running the simulator on, per the answer to this question. I was using an external sound card, and changing the audio settings on my mac in the following way did the trick:
- 输入:内置麦克风
- 输出:内部发言人
希望这会有所帮助.我的代码与您的代码非常相似,我完全认为这与您的代码无关.
Hope this helps. My code is very similar to yours, and I don't think this is a problem with your code at all.
更多推荐
使用iOS模拟器的AVAudioPlayer错误
发布评论