Reputation: 43
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!
Upvotes: 4
Views: 2678
Reputation: 257693
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
}
Upvotes: 8