问题
I'm working on an app that will support CarPlay.It's an audio app.
I'm able to show 2 tabs (favourite and recommended) though I just don't know how to show the Now Playing Tab. I just cannot find any info regarding this. Do I have to manually show it, and the, how do I push? Do I have to do it manually? If so, what's the viewcontroller?
Thanks.
回答1:
For the Transition to the Now Playing tab to work on both the simulator and an actual car, you need to make sure to
- call
beginReceivingRemoteControlEvents
on the currentUIApplication
, and - set a
nowPlayingIdentifier
on theMPPlayableContentManager
before calling the completion handler in playableContentManager:initiatePlaybackOfContentItemAtIndexPath:completionHandler:
.
回答2:
I know this post is a couple months old, but for me, I had to test in an actual device with CarPlay. Apple says always test it on an actual device with CarPlay. At first, I didn't see a Now Playing tab in the simulator, but as soon as it was tested in a device it was there automatically. I didn't do anything special. I think CarPlay knows when you're playing audio via MPNowPlayingInfoCenter and does this automatically in the actual CarPlay device.
来源:https://stackoverflow.com/questions/48494859/how-to-show-the-now-playing-tab-in-carplay