0

I created a new app in Xcode and added the following code in the AppDelegate file

    func updateCarWindow()
    {
        guard let screen = UIScreen.screens.first(where: { $0.traitCollection.userInterfaceIdiom == .carPlay })
            else
        {
            // CarPlay is not connected
            self.carWindow = nil;
            return
        }

        // CarPlay is connected
        let carWindow = UIWindow(frame: screen.bounds)
        carWindow.screen = screen
        carWindow.makeKeyAndVisible()
        carWindow.rootViewController = CarViewController(nibName: nil, bundle: nil)
        self.carWindow = carWindow
    }

and called the function in function application. The app is not showing in the CarPlay external display.

Paulw11
  • 108,386
  • 14
  • 159
  • 186
srb1991
  • 1,026
  • 1
  • 8
  • 14

1 Answers1

0

You don’t have direct access to the carplay screen, carplay manages everything using the CPInterfaceController class that is able to display so called templates (such as CPListTemplate and a handful of others). Your ability to draw on the screen is pretty much limited to drawing maps in a CPMapContentWindow. I recommend you read the Apple docs first starting here: https://developer.apple.com/carplay/documentation/CarPlay-Navigation-App-Programming-Guide.pdf

Don’t forget to set the correct app permissions and carplay entitlements othereise it simply won’t work and it might not tell you why.

And a final word that the Carplay framework is only supposed to work with navigation apps. Everything else would require a lot of workarounds, not to mention it would never pass app review. Hope this helps

Andras M.
  • 838
  • 7
  • 12
  • Thanks for the excellent pdf. But I am developing an automaker app. Anyway I am able to run the app on CarPlay extension. The following link also is helpful https://blog.flitsmeister.nl/start-developing-your-navigation-app-for-carplay-6e4c6c2b4e47. Also if I try to import the the Templates it gives me error that 'CPListTemplate' is only available on iOS 12.0 or newer' – srb1991 Dec 24 '18 at 05:05