Hello,
I've been banging my head against this for a couple of days now
I can't get the CarPlay interface to work on my music app
I see the error: Application does not implement CarPlay template application lifecycle methods in its scene delegate
I've checked the sample code and developer guides and can't see my mistake
My CarPlay delegate code is:
class CarPlaySceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate {
var interfaceController: CPInterfaceController?
var carPlayWindow: UIWindow?
private let playerManager = MusicPlayerManager.shared
private var playlists: MusicItemCollection<Playlist> = []
// MARK: - CPTemplateApplicationSceneDelegate Methods
func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene,
didConnect interfaceController: CPInterfaceController) {
// Store reference to the interface controller to use throughout the app
self.interfaceController = interfaceController
// Request Apple Music authorization if needed
requestMusicAuthorization()
// Configure the interface with the now playing template and specified tabs
setupCarPlayInterface(interfaceController)
}
func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene,
didDisconnectInterfaceController interfaceController: CPInterfaceController) {
// Clean up when CarPlay disconnects
self.interfaceController = nil
print("CarPlay disconnected")
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state
print("CarPlay scene became active")
}
etc
My info.plist contains:
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UISceneConfigurations</key>
<dict>
<key>CPTemplateApplicationSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>CPTemplateApplicationScene</string>
<key>UISceneConfigurationName</key>
<string>TemplateSceneConfiguration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).CarPlaySceneDelegate</string>
</dict>
</array>
</dict>
</dict>
My one doubt is this entry in the plist: UISceneConfigurationName as I can't find any clarity in the docs how to use or implement this
Can anyone suggest where I need to be looking?
Thanks for your help!