Sets the audio session’s category with the specified options.
- iOS 6.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The category to apply to the audio session. See
AVAudiofor supported category values.
A mask of additional options for handling audio. For a list of constants, see
Session Category Options
On input, a pointer to an error object. If an error occurs, the pointer is an
NSErrorobject that describes the error. If you don’t want error information, pass in
YES if the audio session category and options were set successfully; otherwise
The audio session’s category defines how you intend to use audio in your app. Typically, you set the category before activating the session. You can also set the category while the session is active, but doing so results in an immediate route change.
You can tailor the behavior of certain categories by specifying a mask of category options. Specifying an unsupported option for the indicated category results in an error. See
AVAudio for category compatibility.