setActive:error:
Activates or deactivates your app’s audio session.
Declaration
- (BOOL) setActive:(BOOL) active error:(NSError **) outError;Parameters
Return Value
true if the system successfully changed the active state; otherwise false.
Discussion
Your app may activate a session with category playback when another app is hosting a call, for example to start a SharePlay activity. However, your app isn’t permitted to capture the microphone of the active call.
The session fails to activate if another audio session has higher priority than yours (such as a phone call) and neither audio session allows mixing. Deactivating an audio session with running audio objects stops the objects, makes the session inactive, and returns an AVAudioSession.ErrorCode.isBusy error.
When your app deactivates a session, the return value is false but the active state changes to deactivate.