Sets the preferred input port for audio routing.
- iOS 7.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
AVAudioobject that describes the port to use for input.
Session Port Description
On input, a pointer to an error object. If an error occurs, the system sets the pointer to an
NSErrorobject that describes the error. If you don’t want error information, pass in
YES if the request was successfully executed, otherwise
Setting the preferred input port requests a change to the input audio route. To determine whether the change has taken effect, use the
The value of the
in parameter must be one of the
AVAudio objects in the
available array. If this parameter specifies a port that isn’t already part of the current audio route and the app’s session controls audio routing, this method initiates a route change to use the preferred port.
You must set a preferred input port only after setting the audio session’s category and mode and activating the session.