7

Trying to get the WeatherKit Beta working. have had the same error on Xcode 14 Betas 3/4/5 on both the simulator and physical device using the apple provide an example from WWDC or a simple project to load weather data.

The error output is always:

2022-08-12 15:56:02.825925-0400 WeatherPup[47533:15014528] [AuthService] Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=AMSErrorDomain Code=12 "Mescal Failed" UserInfo={NSLocalizedDescription=Mescal Failed, NSLocalizedFailureReason=SAPInit failed: -42049}

Has anyone been successful in building using this Beta yet? I would imagine it should work since the dark sky weather service is still running.

I have all certificates, identifiers, and privileges setup as they should be and triple-checked bundle identifiers, etc.

Charles
  • 95
  • 11

3 Answers3

6

I've had the same issue and here are the 2 things I had to do to make it work:

  1. Make sure that you have the WeatherKit checkbox checked under the development portal in both places - Capabilities and App Services:

enter image description here

  1. As of Beta 5 I've only been able to successfully fetch weather information from the API when building on a real device.
Rog
  • 18,602
  • 6
  • 76
  • 97
  • 1
    I have made sure that capabilities and app services is check, I even cycled them and waited 24 hours. I have made sure the app has the permissions itself, am I running a new beta OS install of Mac and iOS, and new beta install of Xcode as well. still no success. I am using a physical device, but I have not been able to get it to work once. – Charles Aug 17 '22 at 14:11
  • 2
    As with Rog, I can only fetch the weather with a real device and I have only been able to retrieve current weather and a 10 day forecast. That works reliably, but I cannot retrieve historical data. I've tried a lot of approaches. I'm also on Xcode 14 Beta 5, but I have experienced the same behavior since Beta 3. – JohnSF Aug 18 '22 at 01:56
  • For the record: As of iOS 16 and Xcode 14.0.1 You can use WeatherKit and communicate successfully through the server using the simulator. I'm making this note so that people do not chase phantom issues. – Justin Ngan Nov 05 '22 at 12:52
  • 2
    I'm using Apple's WeatherKit library on iOS 16 with XCode 14.1 and still getting this JWT error both in simulator and on real device. Also running XCode on the latest macOS (Ventura 13.0.1) – Mikel Nov 28 '22 at 08:59
1

I believe it has been generally confirmed that WeatherKit is not working correctly on XCode simulators. I haven't been successful yet with a Sim but physical iPhone device works fine. WK documentation is lacking.

S Graham
  • 232
  • 2
  • 14
  • Can't speak to Beta but as of Xcode 14.0.1, for sure you can run your app with WeatherKit on the simulator and get results. Adding this so that others are not confused by this post. – Justin Ngan Nov 05 '22 at 12:53
  • Not working for me on a real device either. Same error. – Mikel Nov 28 '22 at 09:13
0

I have the same issue. It doesn't work on simulator XCode 14 beta 6 and earlier.

It's working only on physical device with iOS16 Beta

Except of using physical device be sure You:

1.Configured correctly identifier. You have to select "WeatherKit" under "Capabilities" and "App Services" and waited at least 30min

2.Be sure You have added WeatherKit capabilities in XCode under Singing & Capabilities tabs in project settings

For more info visit:

https://help.apple.com/developer-account/?lang=en#/devfe6684fd6 https://developer.apple.com/weatherkit/get-started/

  • Can't speak to Beta but as of Xcode 14.0.1, for sure you can run your app with WeatherKit on the simulator and get results. Adding this so that others are not confused by this post. – Justin Ngan Nov 05 '22 at 12:53