xcode - MPNowPlayingInfoCenter info is not displayed on iOS 8
The problem is that you are not satisfying the requirements to become master of the lock screen and control center, as I explain in my book. You should be seeing the modern (iOS 8) equivalent of this:
The fact that you are not seeing it suggests that you are omitting one or more of the requirements, which I list (quoting directly from my book here):
- Your app must contain a UIResponder in its responder chain that
returns YES from
canBecomeFirstResponder
, and that responder must actually be first responder. - Some UIResponder in the responder chain,
at or above the first responder, must implement
remoteControlReceivedWithEvent:
. - Your app must call the UIApplication
instance method
beginReceivingRemoteControlEvents
. - Your app’s audio session’s policy must be Playback.
- Your app must be emitting some sound.
I don't know which of those you are omitting; it could be more than one. You might like to compare your code with a working example, here:
https://github.com/mattneub/Programming-iOS-Book-Examples/blob/master/iOS7bookExamples/bk2ch14p653backgroundPlayerAndInterrupter/backgroundPlayer/backgroundPlayer/ViewController.m
Want to expand @matt's answer - setting nowPlayingInfo is useless when you use AVAudioSessionCategoryOptionMixWithOthers
option.