ios - App Icon won't show in music controls in app switcher -


i'm writing app streams music , i'm having ton of trouble setting icon on music control dock screen (when double-click home button , swipe left). documentation said this, icon never appears , don't ever receive event notification. of code in player view controller. _radioplayer instance of avqueueplayer. doing wrong here?

- (void)viewwillappear:(bool)animated {     uiapplication *application = [uiapplication sharedapplication];     if([application respondstoselector:@selector(beginreceivingremotecontrolevents)])         [application beginreceivingremotecontrolevents];     [self becomefirstresponder]; }  - (bool)canbecomefirstresponder {     return yes; }  - (void)remotecontrolreceivedwithevent:(uievent *)event {     switch (event.subtype) {         case uieventsubtyperemotecontroltoggleplaypause:             [_radioplayer pause];             break;         case uieventsubtyperemotecontrolplay:             [_radioplayer play];             break;         case uieventsubtyperemotecontrolpause:             [_radioplayer pause];             break;         default:             break;     } } 

edit: read through documentation , followed steps it's still not working. here of possible reasons i've come with:

a. music isn't playing yet when viewdidappear called. in documentation states

"your app must “now playing” app. restated, if app first responder >and have turned on event delivery, app not receive remote control events until >it begins playing audio."

i tried calling beginreceivingremotecontrolevents: , becomefirstresponder: after music starts playing doesn't work either. can these called in viewdidappear:? ios automatically detect when music begins playing isn't necessary?

b. there weird using avqueueplayer. i'm positive isn't since event message handled view controller, not player itself.

it may not working because calling beginreceivingremotecontrolevents in viewwillappear instead of viewdidappear. check out documentaion -

- (void)viewdidappear:(bool)animated {      [super viewdidappear:animated];      // turn on remote control event delivery      [[uiapplication sharedapplication] beginreceivingremotecontrolevents]; } 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

php - HTTP_REFERER woes: How can I allow access to a specific page, only when a visitor has visited another specific page beforehand? -

java Extracting Zip file -