我的代码在iOS6上工作正常但在iOS 7中没有,请指导
UInt32 enableMetering = 0;
status = AudioQueueSetProperty(recordState.queue, kAudioQueueProperty_EnableLevelMetering, &enableMetering,sizeof(enableMetering));
if (status) {fprintf(stderr, "Could not enable metering\n"); return NO;}
// this line giving error
**status = AudioQueueStart(recordState.queue, NULL);**
if (status) {fprintf(stderr, "Could not start Audio Queue\n"); return NO;}
recordState.currentPacket = 0;
recordState.recording = YES;
return YES;
错误是
Could not start Audio Queue
Error starting recording
请指导......
答案 0 :(得分:1)
@Kalaichelvan's
comment
是perfect
。
我在iOS 7.1
遇到了类似的问题。在AppDelegate's didFinishLaunchingWithOptions
中添加以下内容:
AVAudioSession * audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error: nil];
[audioSession setActive:YES error: nil];
编辑:上面的代码对我有用