12

I am trying to develop an iOS application compatible with CarPlay.

According to this post Is iOS CarPlay API Public? How to Integrate CarPlay?, I have to be enrolled with Apple’s MFi program, but I have noticed that there’s the possibility to use a CarPlay simulator with Xcode: launch the Simulator, then Hardware -> External Displays -> CarPlay (I use Xcode 8). Once you have opened it, you see that the Message App is working in the CarPlay simulator so I imagine that there is the possibility to try custom application in this simulator without being enrolled in the MFi program. I wonder if anyone has tried to launch an application on the CarPlay simulator and, in case of positive answer, he can explain how he did.

I have also watched the WWDC 2016 (https://developer.apple.com/videos/play/wwdc2016/722/ open it with Safari) that explains the CarPlay system and how it works. At the end of this presentation, they say that you have to declare a string protocol name (like com.brand) in the SupportExternalAccessoryProtocols key in the Info.plist file, but I don't understand how to get the string protocol name.

I also don’t find any information about the simulator and how to develop application compatible with it.

If someone knew something concerning it, it would be a great help.

Thanks in advance.

Community
  • 1
  • 1
F. DePa
  • 143
  • 1
  • 1
  • 8

2 Answers2

17

You don't need to add anything for the SupportExternalAccessoryProtocols key to run a basic CarPlay app in the simulator. This is for declaring protocols for functionality that might be specific to a particular set of head units.

What you are probably missing is the playable content entitlement. If you don't have an entitlements file, you'll need to create it for your app;-

xcode navigator

Then add a boolean value of YES for the com.apple.developer.playable-content key

entitlements file

This should now show your app on the CarPlay home screen in the simulator. As you allude, you won't be able to run that app on a physical device unless you can get Apple to add that entitlement to your account

TotoroTotoro
  • 17,524
  • 4
  • 45
  • 76
deftangel
  • 508
  • 4
  • 12
  • I have added the key to the info.plist but I can't still see my app on the simulator. I have also created another .plist and I've put the key in this new file, but it doesn't work... – F. DePa Mar 13 '17 at 13:45
  • I have also seen that if I want to develop an audio app compatible with CarPlay, I have to use some "special" classes, like this one [link](https://developer.apple.com/reference/mediaplayer/mpplayablecontentmanager) and there is specified that "Apps without the correct entitlement will not appear on the CarPlay home screen." – F. DePa Mar 13 '17 at 13:47
  • The key goes in the entitlements file, not the Info.plist. This worked for me last week – deftangel Mar 13 '17 at 15:18
  • Thanks! It works! Do you know any guides/tutorials on how to develop an Audio App compatible with CarPlay. I know that I have to use classes like this one [link] (https://developer.apple.com/reference/mediaplayer/mpplayablecontentmanager), but I don't find any further explanations. – F. DePa Mar 14 '17 at 09:00
  • Unfortunately, none that I'm aware of. The documentation for CarPlay is very thin on the ground and we had to figure it out ourselves. The best advice I can give is that populating the CarPlay UI with data is very similar to what you would do for a UITableViewController. You provide MPContentItem's via a MPPlayableContentDataSource and there is a MPPlayableContentDelegate for handling requests for playback. Your app handles the playback and the sharedInstance of the MPPlayableContentManager handles the CarPlay UI for you once the datasource and delegate are wired up. – deftangel Mar 15 '17 at 10:18
  • Thanks for your suggestions :) I’ve managed to create a very simple app, it shows an hierarchy of items that can be selected. The problem is that I can’t upload some songs (for example an mp3 file) on the iPhone simulator, so I can’t really test my App. I’ve tried to run my App on a real iPhone, but I’ve got some problems regarding the new Entitlement file. It says that my Provisioning Profile doesn’t include the com.apple.developer.playable-content entitlement (see the picture https://drive.google.com/open?id=0B8JG2tjGchWZX3gyWTk5M3VFVWM). Do you have any ideas about this issue? Thanks :) – F. DePa Mar 20 '17 at 08:27
  • 2
    Unfortunately, this is what I alluded to in the last paragraph of my answer. Unless Apple grant you the playable-content entitlement to use on a provisioning profile on your developer account, then you will not be able to sign or run on a device app builds which include that entitlement. Unlike many of the other capabilities you might add to an app ID (e.g. push notifications, iCloud etc.) you cannot add this capability yourself, it has to be approved by Apple via an application to the MFi program. – deftangel Mar 20 '17 at 15:13
  • 1
    Thanks for your help :) This is a link that maybe can help if you want to develop some Audio apps compatible with CarPlay [link] (https://www.slideshare.net/yuujihato/carplay) – F. DePa Mar 24 '17 at 07:30
  • Glad to have helped, would you mind accepting the answer? – deftangel Mar 30 '17 at 10:57
  • I have selected the Up Arrow near to your answer, is that correct? I am new in StackOverFlow. – F. DePa Mar 31 '17 at 11:54
  • There should be a greyed out checkmark next to my answer;- http://stackoverflow.com/help/someone-answers – deftangel Apr 03 '17 at 12:28
9

As of iOS 12 there is now the entitlement of com.apple.developer.carplay-maps for navigation based apps which works in the same way as com.apple.developer.playable-content so you can test your App in the Simulator. You may need to enable the CarPlay simulator with the terminal command defaults write com.apple.iphonesimulator CarPlay -bool YES to get it to show up.

svarrall
  • 8,545
  • 2
  • 27
  • 32