I am wondering how I change the measurement units on screen in my CPMapTemplate. In my screenshot below the distance is in miles, but how can I change that to kilometers?
Does this need to come from my route data?
I am not seeing this anywhere in the CarPlay programming guide or in the documentation.
Posts under CarPlay tag
125 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Dear Developers,
I'm exploring the feasibility of playing video content on CarPlay when the vehicle is in a parked state. Could you please provide guidance on whether this is supported and, if so, the best practices for implementation?
System: iOS 18.1.1
When connected to Carplay, after playing a song, check the playback page CPNowPlayingTemplate. This error appears on the BMW car, as shown in the picture:
In our project, this is achieved using the following methods:
UIImage *image1 = [UIImage imageNamed:@"imageName"];;
CPNowPlayingImageButton *button1 = [[CPNowPlayingImageButton alloc] initWithImage:image1 handler:^(__kindof CPNowPlayingButton * _Nonnull action) {
//do something
}];
UIImage *image2 = [UIImage imageNamed:@"imageName"];;
CPNowPlayingImageButton *button2 = [[CPNowPlayingImageButton alloc] initWithImage:image2 handler:^(__kindof CPNowPlayingButton * _Nonnull action) {
//do something
}];
NSArray<CPNowPlayingButton *> *buttons;
buttons = @[button1,button2];
[[CPNowPlayingTemplate sharedTemplate] updateNowPlayingButtons:buttons];
Is there any way to solve this problem?
i have a CarPlay implementation eand I want to show previous/next track button on player UI
MPRemoteCommandCenter.shared().seekForwardCommand.isEnabled = false
MPRemoteCommandCenter.shared().seekBackwardCommand.isEnabled = false
MPRemoteCommandCenter.shared().previousTrackCommand.isEnabled = true
MPRemoteCommandCenter.shared().nextTrackCommand.isEnabled = true
It works correctly on CarPlay simulator , but on some car only SEEK button are shown .
I have to suppose that it is that a problem on the car side , but I would ask about your opinion , maybe there is some pieces I'm missing
Hello,
I'm currently developing a CarPlay app using the CPTabBarTemplate, and I need to know if it's possible to disable user interaction with the tab bar, specifically preventing the user from switching between tabs or tapping on the tab items.
Is there a way to lock the selected tab or ignore tab switching attempts programmatically? I would like to maintain the tab bar UI but prevent users from changing tabs or interacting with it while in a certain mode or condition.
Hi,
Despite having CarPlay capabilities authorised for our navigation app, our users are seeing some odd behaviour in the appearance of the icon in the sidebar menu on the side of the CarPlay display.
The documentation suggests the quickbar will show the most recently used: navigation app,
Open our app in CarPlay
Switch to another non-navigation app via CarPlay sidebar
Note that our navigation app remains in sidebar
Switch back to our navigation app
Search for destination, select, tap 'Let's Go' to start navigation
Switch to a non-navigation app via CarPlay sidebar
Note that our app is replaced by another navigation app in the sidebar (Google/Apple), despite being the most recently used
Any ideas?
What is the fix for inability to connect Lexus 2021 RX to CarPLay since iOs came on the scene? I‘ve spent countless hours trouble shooting with Lexus and Apple with no solution. THis all started with my iphone 13 when I updated to IOs 18. HELP
Hi,
I'm building an aftermarket solution to enable Apple Maps to support EV routing for any EV.
I am going through the documentation and found some gaps - does anyone know how the following properties work?
INGetCarPowerLevelStatusIntentResponse - consumptionFormulaArguments
INGetCarPowerLevelStatusIntentResponse - chargingFormulaArguments
Is there a working example that anyone has seen?
Many thanks
I am developing a CarPlay app, that has been approved for EV Charging entitlement. Could you please confirm if the given entitlement supports CPSearchTemplate template as there is some confusion here.
I tried using the template by referring to the below link,
https://developer.apple.com/documentation/carplay/cpsearchtemplate
Here is the snippet,
class SearchCPView: UIResponder, CPSearchTemplateDelegate {
var searchTemplate: CPSearchTemplate = CPSearchTemplate()
override init() {
super.init()
searchTemplate.delegate = self
}
func getSearchTemplate(interfaceController: CPInterfaceController?) -> CPGridTemplate {
let searchGridButton = CPGridButton(titleVariants: [CarplayButtonTitles.search], image: UIImage(named: ImagesConstants.CarPlay.searchGrid) ?? UIImage(), handler: {[self] _ in
guard let controller = interfaceController else { return }
controller.pushTemplate(self.searchTemplate, animated: true) { status, error in
print(status)
}
})
let gridTemplate = CPGridTemplate(title: "", gridButtons: [searchGridButton])
return gridTemplate
}
func searchTemplate(_ searchTemplate: CPSearchTemplate, selectedResult item: CPListItem) async {
print(item)
}
func searchTemplate(_ searchTemplate: CPSearchTemplate, updatedSearchText searchText: String) async -> [CPListItem] {
print(searchText)
return [CPListItem(text: "", detailText: "")]
}
}
On push, I am getting an exception,
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported object <CPSearchTemplate: 0x30056df00> <identifier: 28, userInfo: (null), tabTitle: (null), tabImage: (null), showsTabBadge: 0> passed to pushTemplate:animated:completion:. Allowed classes: {(
CPTabBarTemplate,
CPActionSheetTemplate,
CPAlertTemplate,
CPGridTemplate,
CPPointOfInterestTemplate,
CPInformationTemplate,
CPContactTemplate,
CPListTemplate
)}'
I recently installed a rear-view camera in my car, and ever since, I've been experiencing a frustrating issue with my CarPlay. After about 15 seconds of playing audio via Bluetooth, the sound stops coming out of the speakers, even though the song continues to run in the background.
For context, my stereo system is an aftermarket unit that I installed to enable CarPlay functionality. Everything worked perfectly before adding the rear-view camera. Unfortunately, my unit does not have a port for a wired connection, so I can't test the audio using a cable.
Has anyone experienced a similar issue? Could the camera installation be interfering with the Bluetooth or audio system somehow? Any advice or troubleshooting tips would be greatly appreciated!
I have developed a mobile app using SwiftUI. Now I am in the process of building a CarPlay application. I know how to test the CarPlay app using a simulator but here is my confusion,
Testing the iPhone app and CarPlay together (few scenarios like user login / logout, location enabled /disabled in the mobile app)
Kindly help me validate the above scenarios as I am getting black screen on iPhone whenever the CarPlay is launched. Below is the code snippet,
func application(_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions) -> UISceneConfiguration {
if connectingSceneSession.role == .carTemplateApplication {
let sceneConfiguration = UISceneConfiguration(name: "CarPlay Scene", sessionRole: connectingSceneSession.role)
sceneConfiguration.delegateClass = CarPlaySceneDelegate.self
return sceneConfiguration
}
// Configuration for other types of scenes
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
struct MyApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
var body: some Scene {
WindowGroup {
ContentView()
.preferredColorScheme(.light)
}
}
}
Info.plist
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UISceneConfigurations</key>
<dict>
<key>CPTemplateApplicationSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>CarPlay Scene</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).CarPlaySceneDelegate</string>
</dict>
</array>
</dict>
</dict>
I bought a new iPhone 16 recently and connected with my car (Hyundai Venue) I couldn't able to see WhatsApp. I researched and found some forum, but the suggested steps are not workable or not suitable for latest iOS version.
I have updated iOS and WhatsApp, nothing helped to resolve.
Note: Earlier I was used Pixel phone I can able to see Whatsapp and I can make a call
I have developed a mobile app using SwiftUI. Now I am in the process of building a CarPlay application. I know how to test the CarPlay app using a simulator but here is my confusion,
How to test the iPhone app and CarPlay together? I want to test few scenarios like, user login / logout from mobile app. Location enabled /disabled in the mobile app.
I know that swiftUI handles the scenes by itself. Kindly help me validate the above scenarios as I am getting black screen on iPhone whenever the CarPlay is launched. Below is the code snippet,
func application(_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions) -> UISceneConfiguration {
if connectingSceneSession.role == .carTemplateApplication {
let sceneConfiguration = UISceneConfiguration(name: "CarPlay Scene", sessionRole: connectingSceneSession.role)
sceneConfiguration.delegateClass = CarPlaySceneDelegate.self
return sceneConfiguration
}
// Configuration for other types of scenes
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
struct MyApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
var body: some Scene {
WindowGroup {
ContentView()
.preferredColorScheme(.light)
}
}
}
Info.plist
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UISceneConfigurations</key>
<dict>
<key>CPTemplateApplicationSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>CarPlay Scene</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).CarPlaySceneDelegate</string>
</dict>
</array>
</dict>
</dict>
I bought Pioneer SPH-DA97DAB CarPlay radio but hardly can use the phone due to a loud echo that the caller hears during a call. how can I solve this does CarPlay has echo cancelation?
I have developed a mobile app using SwiftUI that supports GoogleMaps. Now I am in the process of building a CarPlay application. I assume CarPlay only supports Apple MapKit, as I could not find any way to integrate the Google Maps. Below are few queries,
Could you please guide me on how I can obtain the user's current location on the CarPlay app launch? Is there a way CarPlay can get the details from the mobile app(not pretty sure as its using Google Maps)?
If the user is logged out from the mobile app, what is the flow in CarPlay? Do we have any standard login page asking user to login to the mobile app first?
Is there any UI asking the user to capture the location in CarPlay?
This is my first CarPlay app. Kindly guide me to a document or so that covers these details.
Thanks a ton!!
I am new to CarPlay development. I am working on an app that has four tabs. The first tab has a POI template. I make an API call, once the data is received, I need to refresh the POI template to display the data received. Below is a sample code. Please guide me on this. Right now I am pushing a new template once data is obtained which is not the right behaviour
func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didConnect interfaceController: CPInterfaceController) {
self.interfaceController = interfaceController
let tabs = CPTabBarTemplate(templates: [firstTab(), secondTab(), thirdTab(), fourthTab()])
interfaceController.setRootTemplate(tabs,
animated: true,
completion: nil)
}
func firstTab() -> CPTemplate {
// Placeholder template while data is loading
let placeholderPOI = CPPointOfInterest(location: MKMapItem(placemark: MKPlacemark(coordinate: CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0))),
title: "Loading...",
subtitle: "",
summary: "Data is currently loading",
detailTitle: "",
detailSubtitle: "",
detailSummary: "",
pinImage: nil)
let placeholderTemplate = CPPointOfInterestTemplate(title: "EV Stations", pointsOfInterest: [placeholderPOI], selectedIndex: 0)
// Asynchronously update the template once data is loaded
Task {
await loadAndUpdateTimeConsumingData(for: placeholderTemplate)
}
return placeholderTemplate
}
func loadAndUpdateTimeConsumingData(for template: CPPointOfInterestTemplate) async {
do {
// Simulate a 1-minute delay
try await Task.sleep(nanoseconds: 60 * 1_000_000_000)
// Mock data
let stations = [Station1(name: "Station 1", city: "City A", address: "123 Lane", coordinates: (latitude: 12.3456, longitude: 76.7890))]
let pointsOfInterest = stations.map { station -> CPPointOfInterest in
let mapItem = MKMapItem(placemark: MKPlacemark(coordinate: CLLocationCoordinate2D(latitude: station.coordinates.latitude, longitude: station.coordinates.longitude)))
return CPPointOfInterest(location: mapItem,
title: station.name,
subtitle: station.city,
summary: station.address,
detailTitle: "",
detailSubtitle: "",
detailSummary: "",
pinImage: nil)
}
// Update the template
let poiTemplate = CPPointOfInterestTemplate(title: "EV Stations", pointsOfInterest: pointsOfInterest, selectedIndex: 0)
await MainActor.run {
self.interfaceController?.pushTemplate(poiTemplate, animated: true, completion: nil)
}
} catch {
}
}
Hi everyone,
I'm developing a CarPlay application and using a CPTabBarTemplate to display multiple tabs. I want to determine which tab is selected when the user clicks on a tab, specifically when switching to the second tab.
Here’s the relevant part of my code:
class CarPlaySceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate {
var interfaceController: CPInterfaceController?
var tabBarTemplate: CPTabBarTemplate = CPTabBarTemplate(templates: [])
func templateApplicationScene(
_ templateApplicationScene: CPTemplateApplicationScene,
didConnect interfaceController: CPInterfaceController
) {
self.interfaceController = interfaceController
// Create and set the TabBarTemplate
let tabBarTemplate = createTabBarTemplate()
self.tabBarTemplate = tabBarTemplate
interfaceController.setRootTemplate(tabBarTemplate, animated: false) { success, error in
if let error = error {
print("Error setting TabBarTemplate: \(error.localizedDescription)")
} else {
print("TabBarTemplate set successfully.")
}
}
}
func createTabBarTemplate() -> CPTabBarTemplate {
let listItem1 = CPListItem(text: "Item 1", detailText: "Detail 1")
let listItem2 = CPListItem(text: "Item 2", detailText: "Detail 2")
let listTemplate = CPListTemplate(
title: "List",
sections: [CPListSection(items: [listItem1, listItem2])]
)
let gridButton1 = CPGridButton(
titleVariants: ["Grid 1"],
image: UIImage(systemName: "star.fill")!
)
let gridButton2 = CPGridButton(
titleVariants: ["Grid 2"],
image: UIImage(systemName: "star")!
)
let gridTemplate = CPGridTemplate(
title: "Grid",
gridButtons: [gridButton1, gridButton2]
)
return CPTabBarTemplate(templates: [listTemplate, gridTemplate])
}
}
After buying iPhone 16 pro max I’ve had glitches with many things, including carplay, eventually it stopped working altogether. Now it says charging but wont connect to carplay. Ive downloaded the new 18.1.1 reset my velar to factory infotainment, bought new cables, restarted the car, forget car etc. Nothing helps- this se ems to be a theme- including keyboard glitches? I NEED CarPlay as I travel often!! Please fix this- or give me some ideas on how I can!
Just got a new 16 Pro and set it up Monday 11/20. It was on 18.1 and everything worked fine. I accidentally updated to 18.1.1 (didn't turn off auto update) 12/2 and now Carplay doesn't work. I have to use a cord in my car for carplay. I have tried all the suggestions listed online and nothing works. I tried to erase my iPhone to go back to 18.1 but in the set up process it showed updated to 18.1.1 with no option to refuse. Incredibly frustrating and so many others have this issue! How was this not caught during beta testing????
This post was rejected from the apple forum and they sent an email saying it contained beta information. 18.1.1 shouldn't be considered beta and if it is then why was it pushed out to my phone? I didn't want a beta testing!
After upgrading to IOS 18.1.1 CarPlay became terrible.
During music playback via USB cable the subwoofer stopped working. Bass is not heard. Sound became very poor. It is impossible to exit CarPlay by pressing the button on the multimedia. if I Disconnect the cable from the phone - the multimedia (radio) works fine again and the subwoofer works normally.
CarPlay blocks pressing the keys on the multimedia system. Also it is not possible to update the multimedia, because multimedia menu is inaccessible.
When I connect the phone via Bluetooth the timer on the multimedia screen immediately starts, as if I am talking on the phone to somebody. Sound quality via Bluetooth is even worse than via USB.
Listening to music (the main function) has become impossible.
Please fix this problem.
Thank you very much!