次の問題:
<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'
この問題はすでにスタックオーバーフローで見つかりましたが、提供された解決策はどれもうまくいきませんでした。
コード:
#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 ではこのコードは問題なく実行されます。
iOS 6.1 とシミュレーター 6.1 を使用しています