Sto riscontrando problemi nel far passare i pulsanti di riproduzione e di pausa in MPRemoteCommandCenter. Per qualsiasi motivo, l'audio e gli eventi funzioneranno correttamente, ma il centro di comando non modifica il pulsante di riproduzione sul pulsante di pausa. Ecco il mio codice ...MPRemoteCommandCenter pulsante di pausa/riproduzione non attivo?
- (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 the audio pausing and toggling the play button on the app
}
Fatemi sapere se voi potete pensare a niente, mi piacerebbe l'aiuto. Questo mi ha fatto impazzire
Purtroppo nello stesso posto ci si trovi. Hai mai risolto il tuo problema? – Sirens
Sto affrontando lo stesso problema. Qualsiasi aiuto sarebbe apprezzato ! –
Alla fine ho abbandonato questo progetto, mi dispiace per la risposta tardiva! Spero che lo capirai –