Hi,
I created an iOS app compatible watchOS app which was running perfectly fine before I updated my Xcode to use iPhone16. But after updating, I started to get kclErrorDomain error: 1
and I am not sure why is it happening after update.
I am trying to use coreLocation module as-
import Foundation
import CoreLocation
import Combine
class LocationManager: NSObject, ObservableObject, CLLocationManagerDelegate {
private var locationManager = CLLocationManager()
@Published var location: CLLocation?
override init() {
super.init()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.requestWhenInUseAuthorization()
locationManager.startUpdatingLocation()
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let location = locations.last {
self.location = location
print("Updated location: \(location.coordinate.latitude), \(location.coordinate.longitude)")
} else {
print("No locations received")
}
}
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
print("Failed to find user's location: \(error.localizedDescription)")
}
}
and I am trying to use it as-
@StateObject private var locationManager = LocationManager()
guard let currentLocation = locationManager.location else {
signInError = "Location not available"
isLoading = false
return
}
let latitude = currentLocation.coordinate.latitude
let longitude = currentLocation.coordinate.longitude
sendToBackend(email: email, password: password, deviceName: deviceName, deviceModel: deviceModel, deviceIdentifier: deviceIdentifier, latitude: latitude, longitude: longitude)
Can someone help me regarding this?