Temporarily changes the current audio route.
- iOS 6.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The override option for audio output. For a list of constants, see
Session Port Override
On input, a pointer to an error object. If an error occurs, the system sets pointer to an
NSErrorobject that describes the error. If you don’t want error information, pass in
YES if the new audio routing option was set successfully, otherwise
If your app uses the
AVAudio category, calling this method with the
AVAudio option causes the system to route audio to the built-in speaker and microphone regardless of other settings. This change remains in effect only until the current route changes or you call this method again with the
If you’d prefer to permanently enable this behavior, you should instead set the category’s
AVAudio option. Setting this option routes to the speaker rather than the receiver if no other accessory such as headphones are in use.