I am trying to use AVAudioSession setCategory method with several options and I have seen online that you can specify an array to the options argument in swift but cannot figure out how to do it in objective-C. Here is the documentation where you can see the difference of the options argument expected in swift vs objective-C:
I have tried with objective-C arrays and it does store the options expected.
Thanks for your help!
Category options is bit mask. Here is an example of usage
AVAudioSession *session = AVAudioSession.sharedInstance;
NSError *error = nil;
[session setCategory:AVAudioSessionCategoryPlayAndRecord
mode:AVAudioSessionModeVoiceChat
options:AVAudioSessionCategoryOptionDefaultToSpeaker|AVAudioSessionCategoryOptionDuckOthers
error:&error];
if (nil == error)
{
// continue here
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With