ios - MPRemoteCommandCenter pause/play button not toggling? -


i'm having issues getting play , pause buttons toggle in mpremotecommandcenter. whatever reason audio , events work correctly, command center doesn't change play button pause button. here's code...

- (void)setupmpremotecommandcenter{     mpremotecommandcenter *commandcenter = [mpremotecommandcenter sharedcommandcenter];      mpremotecommand *play = [commandcenter playcommand];     [play setenabled:yes];     [play addtarget:self action:@selector(playaudio:)];      mpremotecommand *pause = [commandcenter pausecommand];     [pause setenabled:yes];     [pause addtarget:self action:@selector(playaudio:)];       [commandcenter.skipbackwardcommand setpreferredintervals:@[@30.0]];     mpremotecommand *skipbackwards = [commandcenter skipbackwardcommand];     [skipbackwards setenabled:yes];     [skipbackwards addtarget:self action:@selector(skipbackwardevent:)];      [commandcenter.skipforwardcommand setpreferredintervals:@[@30.0]];     mpremotecommand *skipforwards = [commandcenter skipforwardcommand];     [skipforwards setenabled:yes];     [skipforwards addtarget:self action:@selector(skipforwardevent:)];  } -(void)playaudio: (mpremotecommandhandlerstatus *)event{     [self playaction];     //playaction handles audio pausing , toggling play button on app } 

this issue, media center should show pause button app rather play button.

let me know if guys can think of anything, i'd love help. has been driving me nuts

a few pointers on how solved this. reading apple documentation states "your app must “now playing” app. app not receive remote control events until begins playing audio"

so first start playing audio.

mpremotecommandcenter self reliant module. setenabled used explicitly not going supported. not use toggle during event, avfoundation handle itself.

also note had issues toggling in simulator, toggles fine on device not in simulator, took quick 16 hours figure out :)


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -