Hello everyone,
I'm developing a CarPlay app and am trying to test it with the dock on the right side of the screen, as is standard for right-hand drive vehicles like those in Japan.
Currently, the CarPlay Simulator always displays the dock on the left, and I can't find an option to change its position. This is important for ensuring a proper user experience for my target market.
Has anyone figured out how to configure the simulator for RHD layouts? Any guidance on how to move the dock to the right would be greatly appreciated.
Thanks in advance for your help!
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
Crash when CLLocationUpdate.liveUpdates is called while requesting authorization by CLServiceSession
I watched this video and programmed with this sample code as a reference.
The application crashed when I toggled the switch with the following code.
//
// ContentView.swift
// LiveUpdatesInCoreLocation
//
import os
import SwiftUI
import CoreLocation
@MainActor
final class ContentViewModel: ObservableObject {
private let logger = Logger()
@Published
var updatesStarted: Bool = false {
didSet {
updatesStarted ? self.startLocationUpdates() : self.stopLocationUpdates()
}
}
func startLocationUpdates() {
Task {
let _ = CLServiceSession(authorization: .whenInUse)
for try await update in CLLocationUpdate.liveUpdates() {
guard self.updatesStarted else { break }
logger.debug("update location: \(update.location)")
}
}
}
func stopLocationUpdates() {}
}
struct ContentView: View {
@StateObject private var model = ContentViewModel()
var body: some View {
VStack {
Toggle("Location Updates", isOn: $model.updatesStarted)
}
.padding()
}
}
And this is the error that occurred.
Thread 8: EXC_BAD_ACCESS (code=1, address=0x10)
A bad access to memory terminated the process.
If you remove the below code, the error will not occur.
let _ = CLServiceSession(authorization: .whenInUse)
Therefore, I guess that the problem is in calling CLLocationUpdate.liveUpdates while CLServiceSession is requesting authorization. or am I doing something wrong?