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)