iOS 8中的AVAudioRecorder不处理kAudioFormatMPEG4AAC

ben*_*lak 5 objective-c avfoundation avaudioplayer ios ios8

我的代码工作正常,直到iOS 8,kAudioFormatMPEG4AAC但现在它创建一个空文件.没有报告错误.当我把它更改为kAudioFormatLinearPCM它的工作原理.这是我的代码:

recordSettings = [NSDictionary dictionaryWithObjectsAndKeys:
    [NSNumber numberWithInt:AVAudioQualityMin], AVEncoderAudioQualityKey,
    [NSNumber numberWithInt: kAudioFormatLinearPCM], AVFormatIDKey,
    [NSNumber numberWithInt:16], AVEncoderBitRateKey,
    [NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
    [NSNumber numberWithFloat:32000.0], AVSampleRateKey,
    nil];
Run Code Online (Sandbox Code Playgroud)

mal*_*lex 3

AVEncoderBitRateKey从您的设置字典中删除密钥,它将在 iOS8 上运行kAudioFormatMPEG4AAC

AVEncoderBitRateKey它可能是和之间的特定相关性AVNumberOfChannelsKey。但我没有使用参数,而是使用默认比特率值来获得工作录音机。