I'm making a iPhone music app that handles music playing & pausing and maintains its own play list. This app does not provide next/prev song functions, so I don't want these button to display on iOS's Control Center (the slide-up screen).
I tried the following code to make them disappear from there:
MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter];
// Do not allow next/prev song command on remote control since this is not supported in app either
commandCenter.nextTrackCommand.enabled = NO;
commandCenter.previousTrackCommand.enabled = NO;
[commandCenter.nextTrackCommand addTarget:self action: @selector(emptyFunction)];
[commandCenter.previousTrackCommand addTarget:self action: @selector(emptyFunction)];
This doesn't work: whether or not the app's music is playing, those two buttons still show up in the slide-up screen, and they are not greyed out, and they do function (although not properly, but this is unrelated).
How should I make them disappear?