以下のコードは、Audio Queue Referenceによると、を表すOSStatusエラー1718449215をスローしています。「再生データ形式はサポートされていません」iOSではAVAudioRecorderエラー「再生データ形式はサポートされていません」ですか?
AVFormatKey
をkAudioFormatiLBC
またはkAudioFormatLinearPCM
に変更すると、コードが正しく機能します。 iOSでkAudioFormatMPEG4AAC_HEを使用した録画がサポートされていますか?
NSDictionary *settings =
[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat: 32000.0], AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatMPEG4AAC_HE], AVFormatIDKey,
[NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
[NSNumber numberWithInt: AVAudioQualityMedium], AVEncoderAudioQualityKey,
nil];
NSError *error = nil;
AVAudioRecorder *avRecorder = [[AVAudioRecorder alloc]
initWithURL:url
settings:settings
error:&error];
NSAssert(error.code != 1718449215, @"The playback data format is unsupported.");