Reputation: 10609
following problem:
<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'
I found this problem already here on stackoverflow but none of the provided solutions worked for me.
Code:
#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
Delegate is set. Dont know if its important but on another mac this code runs without problems.
I use ios 6.1 and simulator 6.1
Upvotes: 9
Views: 9521
Reputation: 204
I ran into the same issue, I tried changing the audio settings but it did not help me, I checked that this issue is happening with the simulators that run lower than 14.0 OS, I ran the code in the simulator with OS 14.4, then it worked for me.
Upvotes: 0
Reputation: 81
My solution was: - Set the System preference, Audio input to something else than Internal Mic - In Simulator, set the input to Internal Mic If both of them are the same, it "locks" the Mic somehow.
To all: thanks for answers. I really thought it was my programming bad, but really, it's due to bad design by Apple. This topic was raised 6 years ago and Apple has still not get rid of this bug!
Upvotes: 3
Reputation: 149
Try plugging in a headphone attached with microphone and hopefully the issue'll be solved. Also restart xcode and simulator.
Upvotes: 0
Reputation: 39
I just had this very same issue, but had speakers connected on the headphones jack. Removed the jack, fiddled with the System preferences output audio back to Built-in speakers, then quit Xcode and simulator and relaunch fixed it for me.
Upvotes: 0
Reputation: 513
Confirmed that attaching an audio input device (and restarting the computer) solves the problem. I got this error when shifting from a Macbook Air to a Mac Pro Cylinder after pulling the Git repo over.
I attached my Bose AE bluetooth headset and finally got a meaningful message from Xcode, but it was still aborting:
16:04:10.781 WARNING: 246: Default audio device changed. Restart the simulator to have it use the newly-selected device.
2015-04-21 16:04:19.790 FatBirdsPetAdventure[1622:84473] 16:04:19.790 ERROR: 56: Start: Mach message timeout. Apparently deadlocked. Aborting now.
After restarting the simulator and doing the XCode dance (delete app from simulator, clean project, rebuild) I got another message:
16:06:13.847 ERROR: 56: Initialize: Mach message timeout. Apparently deadlocked. Aborting now.
Finally after restarting the machine, there are no more errors.
Upvotes: 3
Reputation: 338
I spent hours trying to figure this out, if you don't have a microphone or input device then xcode will fail to initialize AVAudioPlayer properly.
That is why plugging in some type of input device works, AVAudioPlayer is searching for an input device . You can run the same app on an iPhone and it will work just fine.
So just plugin some type of input device when running on simulator, I haven't found a way to work around this yet. And it's probably not recommended either.
Upvotes: 2
Reputation: 11349
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.
Upvotes: 25