WeatherKit error on iOS 17 - macOS 14

Hi I upgraded my Mac to test the new os and iOS 17. But I have problems with the weather kit on the app.

WeatherKit enabled as app service and capability there was no issue with the iOS 16.

What could be the problem?

import Foundation
import WeatherKit

class WeatherKitManager: ObservableObject {
    @Published var weather: Weather?
    @Published var isFetchingWeather = false
    
    func getWeather(latitude: Double, longitude: Double) async {
        do {
            let receivedWeather = try await WeatherService.shared.weather(for: .init(latitude: latitude, longitude: longitude))
            DispatchQueue.main.async {
                self.weather = receivedWeather
            }
        } catch {
            fatalError("\(error)")
        }
    }
    
    var symbol: String {
        weather?.currentWeather.symbolName ?? "xmark.app"
    }
    
    var temp: String {
        if let temp = weather?.currentWeather.temperature.converted(to: .celsius) {
            let formattedTemp = String(format: "%.1f", temp.value)
            return "\(formattedTemp)°C"
        } else {
            return "Yükleniyor..."
        }
    }
}

Errors here

Ceyehat/WeatherKitManager.swift:22: Fatal error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
Encountered an error when fetching weather data subset; location=<+37.78583400,-122.40641700> +/- 0.00m (speed -1.00 mps / course -1.00) @ 06/06/2023, 5:32:55 PM GMT+03:00,  error=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors 2 Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
Post not yet marked as solved Up vote post of ademclk Down vote post of ademclk
3.8k views

Replies

I'm seeing the same issue.

Same issue

Problem with WeatherKit, but doesn't work only on the simulator. On the device it works as before. When running on the simulator I get this error: Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"

I'm having the same issue. I tested from Xcode 15 beta and it's simulator and Xcode 14 with that simulator. In both versions the IOS 17 image fails.

  • So it's the simulator the problem? Everything actually points to the simulator as the cause of this issue...

Add a Comment

So it's the simulator the problem? Everything actually points to the simulator as the cause of this issue...

I am having this issue in both the iOS 17 Simulator and on my device running iOS 17 Beta. Hopefully next betas fix this issue.

Experiencing the same problem! Filed a radar: FB12280733

Likewise; filed a dupe: FB12326804.

I am also completely unable to retrieve a forecast in the simulator using Xcode 15 beta 1.

I'm also seeing the same issue with WeatherKit on iOS 17 / Xcode 15 beta 1. I noticed that others are experiencing more general issues with entitlements apparently not working in Xcode 15 B1, even when configured correctly:

https://developer.apple.com/forums/thread/731010

https://developer.apple.com/forums/thread/731116

I'm wondering if the WeatherKit issue we are seeing is a specific instance of this issue -- in this case, the com.apple.developer.weatherkit entitlement not getting picked up correctly. I could imagine this potentially causing auth issues on the backend. Speculation at this point, but it seems to fit.

This is still a problem for me on Xcode 15 beta 2.

I inspected the built .app using codesign:

codesign --display --entitlements :- YourApp.app

And it is in fact missing the com.apple.developer.weatherkit entitlement, despite the fact that it is included in the project's Entitlements file.

Beta 2 did not resolve this... ? seems nutty that a major API just is dead in a beta with tons of people in it but...

I've been getting this same issue on Simulator since Xcode 14 and iOS16 release, seems like it still isn't fixed. It has been especially frustrating because the WeatherKit issue causes some of my CI/CD pipelines to always fail

I'm starting to get support emails from users running the iOS 17 beta reporting that they can't retrieve weather forecasts with my app.

This issue still exists for me in Xcode 15 Beta 3.

I am very surprised that this hasn't been addressed yet, or even mentioned in the Release Notes. Based on the discussion in this thread, no apps using WeatherKit can be built or run on iOS 17 yet.

Has anyone been successful in getting WeatherKit to work on iOS 17?

I also have had this issue since Beta 1. It fails on the simulator and on device. The code previously worked in iOS 16/macOS 13. I confirmed that I have the correct entitlements enabled.

In the simulator, I get the error mentioned in the original post.

Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"

On device, I get a different error

Unable to decode object=, error=keyNotFound(CodingKeys(stringValue: "humidityMax", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "forecastDaily", intValue: nil), CodingKeys(stringValue: "days", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0)], debugDescription: "No value associated with key CodingKeys(stringValue: \"humidityMax\", intValue: nil) (\"humidityMax\").", underlyingError: nil))

I filed feedback separately since I wasn't sure if this was the same problem. The simulator error is filed as FB12539864 and the on-device error is filed as FB12539932.

Add a Comment