The code below is throwing an OSStatus error 1718449215 which, according to the Audio Queue Reference, represents “The playback data format is unsupported.”
The code works correctly if I change the AVFormatKey to be kAudioFormatiLBC or kAudioFormatLinearPCM. Is recording using kAudioFormatMPEG4AAC_HE supported on iOS?
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.");
The Apple docs, specifically the Multimedia Programming Guide ( http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/MultimediaPG/UsingAudio/UsingAudio.html ), only lists the HE-AAC as a playback format. Regular AAC is listed for both playback and recording. So, it looks like HE-AAC only has partial support.