I just noticed something really odd with WeatherKit.
If the temperate at midnight of the FOLLOWING day is colder than all temps in the day you want weather for then WeatherKit will report that as the low temperature for the day even though it's a different day.
Here it's reporting the lowest temp for Feb 6 is 22F. But that's a temp from Feb 7. I'm displaying lowTemperature and lowTemperatureTime from DayWeather as well as the HourWeather in these examples.
I wasn't sure if this was working as designed or a bug. I can provide raw data from this example.
----daily formatted start
weather for Feb 6
High 41°
high at Feb 6 at 2 PM
Low 22°
low at Feb 7 at 12 AM
----daily formatted end
Feb 6 at 12 AM 34°
Feb 6 at 1 AM 35°
Feb 6 at 2 AM 36°
Feb 6 at 3 AM 36°
Feb 6 at 4 AM 36°
Feb 6 at 5 AM 34°
Feb 6 at 6 AM 33°
Feb 6 at 7 AM 33°
Feb 6 at 8 AM 33°
Feb 6 at 9 AM 33°
Feb 6 at 10 AM 35°
Feb 6 at 11 AM 36°
Feb 6 at 12 PM 38°
Feb 6 at 1 PM 40°
Feb 6 at 2 PM 41°
Feb 6 at 3 PM 40°
Feb 6 at 4 PM 39°
Feb 6 at 5 PM 37°
Feb 6 at 6 PM 36°
Feb 6 at 7 PM 33°
Feb 6 at 8 PM 31°
Feb 6 at 9 PM 29°
Feb 6 at 10 PM 27°
Feb 6 at 11 PM 24°
Feb 7 at 12 AM 22°
WeatherKit
RSS for tagBring weather information to your apps and services through a wide range of data that can help people stay up to date, safe, and prepared.
Posts under WeatherKit tag
66 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I've noticed that very consistently the Weatherkit API times out when I make a large(-ish) number of calls at 7am east coast time.
If I make x calls between 7:00:00 and 7:01:00 about half of them time out (as do retries.)
If I make 2x the calls between 7:15:00 and 7:16:00 there are close to zero time outs.
I've looked at the logs, at the calls per second, etc., and there is no difference between 7 and 7:15.
So, I'm not hitting a rate limit. It seems like Weatherkit itself just can't handle the traffic at peak times.
Is there any other explanation? Does Apple intend to make sure the API can handle all the traffic they are getting paid to handle?
I am really confused by some of the new data returned in WeatherKit for iOS 18.
The visibility (of an object) was already being returned in HourWeather as a Measurement.
iOS 18 added max/min visibility (of terrain) in DayWeather. BUT instead of a Measurement it's just a Double.
HourWeather:
/// The distance at which an object can be clearly seen.
///
/// The amount of light and weather conditions like fog, mist, and smog affect visibility.
public var visibility: Measurement<UnitLength>
DayWeather's comment:
/// The maximum distance at which terrain is visible for the day.
///
/// The amount of light, and weather conditions like fog, mist, and smog affect visibility.
@available(iOS 18.0, macOS 15.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *)
public var maximumVisibility: Double
This makes it sound like the new items are also a distance and not a percentage.
Why wasn't Measurement used so the unit would be clear? Documentation doesn't explain this either. I'm hoping that this isn't being returned in the unit used by the current locale because my app lets you specify what unit to use for temperature, length, etc regardless of locale. Since all the temperature, length, etc data returned had used Measurement that was possible.
The iOS weather app refers to the lowest/highest visibility in my preferred unit, which is miles.
I have been using the hourly weather forecast API, for some reason sometimes the API fails with 400 Bad Request, but on retrying just a minute later the call successfully returns data. The start and end time are 2 days apart so I don't think it's an issue with the time frame.
The failed calls also don't return any reason so not sure what is the exact failure.
Has anyone encountered this issue or knows why this might be happening??
Thanks!!
Hey,
I'm trying to update my old app that used DarkSky to WeatherKit, and struggling. I always get:
ailed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
This is regardless if I do it on my iPad, or in the simulator. I have done the following:
Selected WeatherKit on the Capabilities and App Services tabs of the Identifier section on developer.
Put it under signing and capabilities in XCode
I've tried making a new provisioning profile, cleaning build folder, etc. Not sure what to do here. I suspect part of this problem is that I developed this app in 2018 and now I'm trying to update it.
I am able to run the app on TestFlight, but not as an internal tester. Apple won't let me, so I have to add myself as an external tester.
Thanks for any help you can provide!
I filed FB16332997 about the VERY high snowfall estimates I'm seeing in WeatherKit and iOS Weather. I initially thought something was wrong with my weather app but I verified the numbers with the iOS Weather app and another third party weather app.
For Atlanta last week it was saying 7.5" when it ended up being 2" (which I can live with).
Two days ago it reported there could be 16" of snow in northern Florida. That's impossible!
This morning it was reporting that Niceville could have 6-7" of snow, which would be significantly more than highest amount in recorded history for Florida (where snow is extremely rare).
It almost makes me wonder if the liquid precipitation value is actually the snowfall amount in reality. And then that is incorrectly being converted to the snowfall amount.
Hello,
I have an app on the App Store built around WeatherKit and it was working fine, up until this morning when I started seeing errors when using the app.
When debugging using Xcode I see the familiar error
Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
which, according to what I've read on the forums looks like an authentication error.
Attaching a network debugger to the Simulator, I saw this error:
This I have tried:
Verify that WeatherKit is enabled on both Capabilities and App Services tabs on the Dev Portal.
Toggle on/off this value and regenerate Provisioning Profiles
Uninstall/reinstall
Checking that I have API available calls.
Nothing. If I create a new Bundle ID and sign with that, it works correctly. But this is not an option since that will force all my customers to download everything from scratch.
I am getting emails from customers demanding money back and I can't figure out what has happened.
The only thing I can think of, is that I started developing an Apple Watch app to complement the iOS app, but that was last week and everything was working fine.
After changing the bundle identifier of my app, I’ve encountered several issues that I can’t seem to resolve, even though I’ve followed all the necessary steps. The app with the previous identifier was live on Testflight, and working perfectly fine, but now I’m facing the following problems:
WeatherKit Authentication Issue
WeatherKit has stopped working, and I’m getting authentication errors. I’ve updated the app in the Developer Portal to reflect the new bundle ID, but it still doesn’t authenticate properly.
Xcode Cloud Configuration Issue:
Xcode is asking me to set up Xcode Cloud again, which I understand is expected after a bundle ID change. However, during the setup process, it fails to recognize my remote repository, even though the repository is correctly added and visible under the Source Control tab.
TestFlight Internal Testing Issue:
I manually uploaded a build to TestFlight, but internal testers cannot use it because the invitation appears as invalid. This wasn’t an issue with the app’s previous identifier.
It seems like the bundle ID change has caused some fundamental issues that I can’t resolve despite following all the usual instructions. Has anyone experienced this before or knows how to resolve these problems?
I'm using the latest Xcode 16.2 on Mac OS Sequoia 15.2
Topic:
Developer Tools & Services
SubTopic:
Xcode Cloud
Tags:
Bundle ID
TestFlight
Xcode Cloud
WeatherKit
Hi there,
I am using WeatherKit to display weather forecast information in an app.
I would like to include some information about when the weather forecast was issued for my users to see.
This information is included in the response Metadata as documented in the WeatherKit REST API docs:
https://developer.apple.com/documentation/weatherkitrestapi/metadata
Specifically there is a “reportedTime” property which I would like to use here.
However I am consuming WeatherKit via the Swift API, I don’t see this property available via the Swift APIs.
How can I access the reportedTime property via the WeatherKit Swift APIs? Or is it not exposed via the Swift APIs?
Hi There,
My app displays both daily and hourly forecast information, as consumed from the Weatherkit API.
I would also like to let my users know when the forecast was generated/issued. The reason being, if a forecast was issued 1-2 hours in the past for example, then the user(s) will know to refresh the weather forecast for the latest information soon.
Looking through the docs, I don't see any way of accessing this information. I would expect it to be available on the hourlyForecast.metadata property.
Does anyone know if it's possible to obtain the 'issued time' of the forecast? (both hourly and daily).
Thanks
Hi,
I'm trying to implement WeatherKit for the first time and I am seeing this error when calling for the weather:
Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
and
Encountered an error when fetching weather data subset; location=<+51.57750785,-2.08241362> +/- 6.55m (speed -1.00 mps / course -1.00) @ 11/01/2025, 11:50:45 Greenwich Mean Time, error=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors 2 Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
I have:
Enabled the WeatherKit capability in my iOS app in XCode
Added Weatherkit to the AppID in the developer portal
Any suggestions what else I can check?
I'm running iOS 18.2.1 on 15 ProMax with XCode 16.2
Hello,
We are a happy user of WeatherKit REST API.
When can I expect weatherAlerts to work in Japan?
The availability endpoint doesn't return weatherAlerts and I hope it's coming soon.
Hello. I took a closer look at the data I'm getting back for hourly forecasts and I'm baffled by results I'm seeing.
For example, it's Dec 19, 2022 8:00am PT and I'm asking for the weather for Orchard Park NY (lat 42.766437 long -78.743855) for Dec 23, 2022. The daily forecast tells me they're expected to have 5.9" of snow. However, the hourly forecast with the most snow that day is reported as 0.071" (1.8mm). The Apple Weather app on iOS shows that hour as having 0.6".
I wrote a 'for' loop to print the results of my call to WeatherService.shared.weather.
print(oneHour.precipitationAmount.formatted())
print(oneHour.precipitationAmount.description)
print(oneHour.precipitationAmount.unit)
print(oneHour.precipitationAmount.value)
0.071 in
1.8 mm
<_NSStatic_NSUnitLength: 0x2010b0178> mm
1.8
I'm doing a weather app, users can search locations for getting weather, but the problem is, the results only shows locations in my country, not in global. For example, I'm in China, I can't search New York, it just shows nothing. Here's my code:
@Observable
class SearchPlaceManager: NSObject {
var searchText: String = ""
let searchCompleter = MKLocalSearchCompleter()
var searchResults: [MKLocalSearchCompletion] = []
override init() {
super.init()
searchCompleter.resultTypes = .address
searchCompleter.delegate = self
}
@MainActor
func seachLocation() {
if !searchText.isEmpty {
searchCompleter.queryFragment = searchText
}
}
}
extension SearchPlaceManager: MKLocalSearchCompleterDelegate {
func completerDidUpdateResults(_ completer: MKLocalSearchCompleter) {
withAnimation {
self.searchResults = completer.results
}
}
}
Also, I've tried to set searchCompleter.region = MKCoordinateRegion( center: CLLocationCoordinate2D(latitude: 0, longitude: 0), span: MKCoordinateSpan(latitudeDelta: 180, longitudeDelta: 360) ), but it doesn't work.
I am trying to add WeatherKit support to a commandline app to fetch historical data. I've configured an app ID with the WeatherKit entitlement, but WeatherKit does not appear in the Capabilities list to add. When I try to access weather data, it fails with Code=4097 "connection to service named com.apple.weatherkit.authservice" suggesting it's not authorized.
How do I add the WeatherKit entitlement to a commandline Swift app?
I've been using the weather kit API for months now without issue, but all of a sudden API queries return the response {"reason": "EXPIRED"}. The code around this area hasn't changed since June and the credentials haven't changed. The JWT is refreshed frequently (well within expiration). Have looked at the generated JWT in jwt.io and Payload and Header details correct and jwt.io reports JWT as "signature verified".
Is the JWT a red herring and its something else?
Here's an example URL:
https://weatherkit.apple.com/api/v1/weather/en_AU/-37.37834963844341/144.76238003519637?dailyStart=2024-12-12T13:00:00Z&dailyEnd=2024-12-13T13:00:00Z&timeZone=Australia/Melbourne&dataSets=forecastDaily
Would appreciate any insights you may have.
Specifically,
In (https://developer.apple.com/account/resources/identifiers/):
I can't find the Weatherkit option under Capabilities or App Services in the configuration of the identifier.
In Xcode:
Add WeatherKit capability fail. output log:
The capability associated with "WEATHERKIT" could not be determined. Please file a bug report at https://feedbackassistant.apple.com and include the Update Signing report from the Report navigator.
Is it related to my region and account?
My account is Apple Developer Enterprise Program , the region is Mainland China.
We have a service that was accessing the WeatherKit Api. We had the service up and running, using JWT authorisation and a registered service. Some time ago it stopped working, returning a 401 response. We need the service to be up again now.
We created a new JWS token following this instruction: https://dev.iachieved.it/iachievedit/weatherkit-rest-api/ which already workedfor us in 2022. However, we keep receiving a 401 error and the "reason": "NOT_ENABLED" message. We found that several other uses seem to be experiencing similar problems. We also created a new key and service identifier, but no luck.
I haven't gotten any hits searching for this, so I decided to open a new thread.
The Tech Note that was mentioned in an earlier 2024 thread doesn't mention this error.
I've been trying different ways to get a token, and finally found this article that seems to be in the correct format.
https://dev.to/hasone/generate-jwt-token-for-apple-store-connect-api-using-python-3j5h
The Apple App Store Server Swift Library was supposed to have a createJWT() method, but it's gone now.
curl -v -H 'Authorization: Bearer [token]' "https://weatherkit.apple.com/api/v1/availability/37.323/122.032?country=US"
Host weatherkit.apple.com:443 was resolved.
IPv6: (none)
IPv4: 23.66.3.87, 23.66.3.70, 23.66.3.74, 23.66.3.72, 23.66.3.81, 23.66.3.75, 23.66.3.91, 23.66.3.71, 23.66.3.73
Trying 23.66.3.87:443...
Connected to weatherkit.apple.com (23.66.3.87) port 443
ALPN: curl offers h2,http/1.1
(304) (OUT), TLS handshake, Client hello (1):
CAfile: /etc/ssl/cert.pem
CApath: none
(304) (IN), TLS handshake, Server hello (2):
(304) (IN), TLS handshake, Unknown (8):
(304) (IN), TLS handshake, Certificate (11):
(304) (IN), TLS handshake, CERT verify (15):
(304) (IN), TLS handshake, Finished (20):
(304) (OUT), TLS handshake, Finished (20):
SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384 / [blank] / UNDEF
ALPN: server accepted http/1.1
Server certificate:
subject: C=US; ST=California; O=Apple Inc.; CN=weather-data.apple.com
start date: Oct 9 21:14:44 2024 GMT
expire date: Jan 7 20:21:03 2025 GMT
subjectAltName: host "weatherkit.apple.com" matched cert's "weatherkit.apple.com"
issuer: C=US; O=Apple Inc.; CN=Apple Public Server ECC CA 1 - G1
SSL certificate verify ok.
using HTTP/1.x
GET /api/v1/availability/37.323/122.032?country=US HTTP/1.1
Host: weatherkit.apple.com
User-Agent: curl/8.7.1
Accept: /
Authorization: Bearer [token]
Request completely sent off
< HTTP/1.1 401 Unauthorized
< Server: Apple
< Content-Type: application/json
< Content-Length: 26
< X-Frame-Options: SAMEORIGIN
< Strict-Transport-Security: max-age=31536000; includeSubdomains
< X-XSS-Protection: 1; mode=block
< Access-Control-Allow-Origin: *
< X-Content-Type-Options: nosniff
< Content-Security-Policy: default-src 'self';
< X-REQUEST-ID: 320cab08-acba-0127-fe19-4893dacf059c
< X-Apple-Origin: 3c6511d9-6be2-32cb-8412-efd1b1efa576
< Content-Disposition: inline;filename=f.txt
< Date: Tue, 15 Oct 2024 10:40:01 GMT
< X-Cache: TCP_MISS from a23-220-165-87.deploy.akamaitechnologies.com (AkamaiGHost/11.6.5-30d892fcde524eb1bee7eeb45111707d) (-)
< Connection: keep-alive
<
Connection #0 to host weatherkit.apple.com left intact
{"reason": "MISSING_AUTH"}
大家好,
我目前正在开发一个需要使用WeatherKit的iOS应用程序。我已在我的aioutfit3.entitlements文件中添加了必要的权限,如下所示:
<?xml版本="1.0"编码="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist版本="1.0">
<字典>
<键>com.apple.developer.weatherkit</键>
<真实/>
</字典>
尽管如此,当我试图获取天气数据时,该应用程序报告说它找不到授权文件,并特别提到WeatherKit授权缺失。以下是日志输出的一部分:
❌未找到权利文件
📱捆绑ID:com.superhuang.aioutfit3
❌未找到WeatherKit权利
我已确认授权文件在Xcode项目中配置正确,并已尝试清理和重建该项目。然而,这个问题仍然存在。
有人遇到过类似的问题吗?或者有人有可能有助于解决这个问题的建议吗?非常感谢您的帮助!
我希望这个帖子的内容能帮助你在论坛上找到解决方案。如果您需要更多信息或修改,请告诉我!
一些图片