Technical Q&A QA1872

Recording Audio from an App Extension

Q:  Can I record audio from an app extension on iOS 8?

A: App extensions in iOS 8 are not allowed to record audio. There are a number of AudioToolbox framework functions and AVFoundation methods that will return errors (for example AVAudioSessionErrorCodeCannotStartRecording) if an app extension attempts to start recording audio.

Some examples of AVFoundation methods that will return errors if recording is attempted are:

AVAudioRecorder (see AVAudioRecorder.h)
 
- (BOOL)record;
- (BOOL)recordAtTime:(NSTimeInterval)time;
- (BOOL)recordForDuration:(NSTimeInterval) duration;
- (BOOL)recordAtTime:(NSTimeInterval)time forDuration:(NSTimeInterval) duration
AVAudioEngine (see AVAudioEngine.h) in cases where the inputNode object is used.
 
- (BOOL)startAndReturnError:(NSError **)outError;

Some examples of AudioToolbox functions that will return errors if recording is attempted are:

AudioQueueStart() (see AudioQueue.h) when used with an AudioQueue object created by a call to AudioQueueNewInput().
 
AUGraphStart() (see AUGraph.h) or AudioOutputUnitStart() (see AudioOutputUnit.h) if the input element on the Remote I/O (kAudioUnitSubType_RemoteIO) or Voice Processing (kAudioUnitSubType_VoiceProcessingIO) audio unit has been enabled.


Document Revision History


DateNotes
2014-08-14

New document that discusses audio recording from an App Extension.