Не удалось сгенерировать токен jwt для: com.apple.weatherkit.authservice для macOS.
Я пытаюсь получить текущую погоду в своем местоположении, однако получаю следующее:
Не удалось сгенерировать токен jwt для: com.apple.weatherkit.authservice с ошибкой: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
class LocationManager: NSObject, ObservableObject{
@Published var currentLocation: CLLocation?
private let locationManager = CLLocationManager()
override init(){
super.init()
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.distanceFilter = kCLDistanceFilterNone
locationManager.requestAlwaysAuthorization()
locationManager.startUpdatingLocation()
locationManager.delegate = self
}
}
extension LocationManager: CLLocationManagerDelegate{
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
guard let location = locations.last, currentLocation == nil else {return}
DispatchQueue.main.async {
self.currentLocation = location
}
}
func locationManager(_ manager: CLLocationManager,
didFailWithError error: Error) {
print( "location manager failed with error \(error)" )
}
}
struct MainView: View {
let weatherService = WeatherService.shared
@StateObject private var locationManager = LocationManager()
var body: some View {
VStack{
Text("Hello, World!")
}.task(id: locationManager.currentLocation){
do{
if let location = locationManager.currentLocation{
let weather = try await weatherService.weather(for: location)
print(weather)
}
}catch{
print(error)
}
}
}
}
Я добавил возможность прогноза погоды в информацию о своем приложении и на портале разработчиков, что дает?