Pergunta

If I set an AVAudioSession category by enabling some options (by using setCategory:withOptions:error:), and later I call setCategory:error: , what happens to the previously set options?

  1. Do they keep their state?
  2. Are they all reset to their respective default value?

If the answer is #1, what happens if the new category is not compatible with the enabled option? Is it automatically disabled by the system? I tried to read the documentation, but I couldn't find that particular info.

Thank you.

Foi útil?

Solução

The options don't keep their state when a category change occurs.

The categoryOptions property of your applications AVAudioSession shared instance is assigned a value of 0 when there are no options set using either of the setCategory methods currently available.

For example this line -

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];

is equivalent to -

AVAudioSessionCategoryOptions AVAudioSessionCategoryOptionsNone = 0;
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionsNone error:nil];
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top