Instance Method


Sets the audio session category, mode, and desired options.


- (BOOL)setCategory:(AVAudioSessionCategory)category mode:(AVAudioSessionMode)mode options:(AVAudioSessionCategoryOptions)options error:(NSError * _Nullable *)outError;



The category to apply to the audio session. See Audio Session Categories for supported category values.


The audio session mode to apply to the audio session. For a list of values, see Audio Session Modes.


A mask of additional options for handling audio. For a list of constants, see AVAudioSessionCategoryOptions.


On input, a pointer to an error object. If an error occurs, the pointer is set to an NSError object that describes the error. If you do not want error information, pass in nil.

Return Value

Returns YES if the audio session category and options were set successfully, or NO otherwise.


The audio session's category and mode together define how your app intends to use audio. Typically, you set the category and mode before activating the session. You can also set the category or mode while the session is active, but this results in an immediate change.

See Also

Configuring the Audio Session


The current audio session category.

- setCategory:error:

Sets the current audio session category.

- setCategory:withOptions:error:

Sets the audio session category with the specified options.


The audio session categories available on the current device.


The mask of options associated with the current audio session category.


The current audio session mode.

- setMode:error:

Sets the audio session mode.


The audio session modes available on the device.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software