美文网首页iOS Developer
iOS 10系统之后的录音问题

iOS 10系统之后的录音问题

作者: ironbody | 来源:发表于2016-11-30 18:12 被阅读0次

近日的需求,自己录音,转mp3之后发送给服务器,在iOS10之前没有任何问题,但是在10的系统之后会出现无论怎么录音都没有音频的问题,因为是使用的lame转,还查了半天lame,后来几经折腾才发现,是10之后AVAudioRecorder 需要使用的话需要配置AVAudioSession 代码如下:

AVAudioRecorder*recorder = [[AVAudioRecorder alloc] initWithURL:[NSURL URLWithString:urlPath] settings:settings error:&error];

AVAudioSession *session = [AVAudioSession sharedInstance];

NSError *sessionError;

[session setCategory:AVAudioSessionCategoryRecord error:&sessionError];

之后再次调用才实现正常录音功能!

相关文章

网友评论

    本文标题:iOS 10系统之后的录音问题

    本文链接:https://www.haomeiwen.com/subject/lyptmttx.html