CarPlay: Can't set CMMapTemplate as a Root Template

Can't find the answer and a bit stuck. Ended up with copying code directly from the Apple sample application (Costal Raods).


Here is the very simple code:


class CarPlaySceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate, CPMapTemplateDelegate {
    
    var mapCarPlayController: MapCarPlayController?
    let mainMapViewController = CarPlayMapViewController(nibName: nil, bundle: nil)
    
    func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didConnect interfaceController: CPInterfaceController) {
        mapCarPlayController = MapCarPlayController()
        interfaceController.delegate = mapCarPlayController

        let mapTemplate = CPMapTemplate()
        mapTemplate.mapDelegate = self
        interfaceController.setRootTemplate(mapTemplate, animated: true)
    }
    
    
    func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didDisconnectInterfaceController interfaceController: CPInterfaceController) {
        mapCarPlayController = nil
    }
    
}


That porduces the exception once I try launching the app on a CarPlay simulator

CrashLog:





Can be something wrong with my configuration, entitlements?

XCode Version 15.3 (15E204a)

Simulator: iPhone 15 (iOS 17.2)

Posted on Mar 17, 2024 9:32 AM

Reply
Question marked as Top-ranking reply

Posted on Mar 17, 2024 3:27 PM

So, I've found out that I don't have the correct entitlement to set CPMapTemplate as the root template.

Based on the documentation, it is available only with "Navigation" entitlement. I have the "Driving Task"

Similar questions

2 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

CarPlay: Can't set CMMapTemplate as a Root Template

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.