私はこれを2つの異なるiPad3でテストしましたが、一方では.m4aファイルと.cafファイルの両方を記録および再生でき、もう一方では.cafファイルしか再生できません。
私がやっていることは、設定を使用して.m4aファイルを記録することです
AVFormatIDKey set to kAudioFormatMPEG4AAC
1台のiPadでは正常に動作します。他のiPadでテストすると、記録されたファイルを再生しようとすると、「OSStatusエラー1685348671」というエラーが発生します。
ただし、その設定をコメントアウトして.cafファイルとして記録すると、問題なく機能します。
ここに関連するコードスニペットがあります:
NSDictionary *recorderSettings = [NSDictionary dictionaryWithObjectsAndKeys:
//[NSNumber numberWithInt:kAudioFormatMPEG4AAC], AVFormatIDKey,
[NSNumber numberWithInt:AVAudioQualityMin], AVEncoderAudioQualityKey,
[NSNumber numberWithInt:16], AVEncoderBitRateKey,
[NSNumber numberWithInt:1], AVNumberOfChannelsKey,
[NSNumber numberWithFloat:16000.0], AVSampleRateKey, nil];
それから私は行って簡単に電話します
AudioRecorder *audioRecorder = [[AVAudioRecorder alloc] initWithURL:soundFileURL settings:recorderSettings error:&error];
再生するには、電話します
AudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:&error];
[audioPlayer play];
ありがとう