I am using
-(void)remoteControlReceivedWithEvent:(UIEvent *)event
in combination with
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
instead of MPRemoteCommandCenter.
With previous SDKs I was able to use this perfectly and remoteControlReceivedWithEvent was getting called every single time.
I don't know starting with which SDK but with 12.1 SDK, I couldn't get this method called by the system until I set withOptions parameter to 0 instead of anything else as shown below. So, here comes my question. Why setting the category with options causes this problem and why setting it to 0 fixes the problem and how can I set the option without causing the problem?
[session setCategory:sessionCategory
withOptions:0 //AVAudioSessionCategoryOptionDuckOthers
error:&sessionError];
I also noticed that if I set the category with no options and later try to set the option like the following, it will again stop sync with the remote control events.
UInt32 uiothersShouldDuck = true;
nerr =AudioSessionSetProperty (
kAudioSessionProperty_OtherMixableAudioShouldDuck,
sizeof (uiothersShouldDuck),
&uiothersShouldDuck
);
I am just unable to set any options, at the beginning or later. Why?