gpt4 book ai didi

iphone - 通过AudioQueueStart功能在iOS7中进行录音

转载 作者:行者123 更新时间:2023-12-02 23:15:01 35 4
gpt4 key购买 nike

我的代码在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

请指导...

最佳答案

@Kalaichelvan's commentperfect

我在iOS 7.1中遇到了类似的问题。在AppDelegate's didFinishLaunchingWithOptions中添加以下内容:

AVAudioSession * audioSession = [AVAudioSession sharedInstance]; 
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error: nil];
[audioSession setActive:YES error: nil];

编辑:上面的代码对我有用

关于iphone - 通过AudioQueueStart功能在iOS7中进行录音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21728523/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com