Mul*_*ard 5 runtime-error avaudioplayer ios-simulator
以下问题:
<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'
Run Code Online (Sandbox Code Playgroud)
我在stackoverflow上已经发现了这个问题,但是所提供的解决方案都没有为我工作.
码:
#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
Run Code Online (Sandbox Code Playgroud)
代表已设置.不知道它是否重要但在另一个mac上这个代码运行没有问题.
我使用ios 6.1和模拟器6.1
归档时间: |
|
查看次数: |
4984 次 |
最近记录: |