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.
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
68 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
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'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.
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.
大家好,
我目前正在开发一个需要使用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项目中配置正确,并已尝试清理和重建该项目。然而,这个问题仍然存在。
有人遇到过类似的问题吗?或者有人有可能有助于解决这个问题的建议吗?非常感谢您的帮助!
我希望这个帖子的内容能帮助你在论坛上找到解决方案。如果您需要更多信息或修改,请告诉我!
一些图片
I'm using WeatherKit for my weather app built with SwiftUI. Even though the location is set in an area where the NWS is issuing weather alerts, WeatherKit randomly returns availability.alertAvailability as temporarilyUnavailable or unsupported, and the weatherAlerts is always nil.
Hello fellow developers,
I’m posting this short message because I’m trying to add WeatherKit to my application, but I’m running into a problem.
I have correctly declared my application on Apple’s website under Certificates, IDs & Profiles, and I have checked WeatherKit.
However in Xcode, I do not have the option to add WeatherKit in Signing & Capabilities.
The option doesn’t appear even though I have the Automatically manage signing box checked.
What can I do to resolve this issue?
Thank you for your response.
HI there,
when requesting the daily forecast via the WeatherKit REST API, I found out that under certain circumstances the moon phase full is skipped.
Example from Japan (working):
{
"forecastDaily": {
"name": "DailyForecast",
"metadata": {
"attributionURL": "https://developer.apple.com/weatherkit/data-source-attribution/",
"expireTime": "2024-10-21T15:16:10Z",
"latitude": 35.650,
"longitude": 139.840,
"readTime": "2024-10-21T14:16:10Z",
"reportedTime": "2024-10-21T12:00:37Z",
"units": "m",
"version": 1,
"sourceType": "modeled"
},
"days": [
...,
{
"forecastStart": "2024-10-16T15:00:00Z",
"forecastEnd": "2024-10-17T15:00:00Z",
"conditionCode": "MostlyCloudy",
"maxUvIndex": 4,
"moonPhase": "waxingGibbous",
"moonrise": "2024-10-17T07:47:26Z",
"moonset": "2024-10-16T20:09:01Z",
"precipitationAmount": 0.09,
"precipitationChance": 0.43,
"precipitationType": "rain",
...
"windSpeedMax": 16.03,
},
{
"forecastStart": "2024-10-17T15:00:00Z",
"forecastEnd": "2024-10-18T15:00:00Z",
"conditionCode": "Rain",
"maxUvIndex": 4,
"moonPhase": "full",
"moonrise": "2024-10-18T08:20:34Z",
"moonset": "2024-10-17T21:24:49Z",
"precipitationAmount": 4.83,
"precipitationChance": 0.83,
"precipitationType": "rain",
...
"windSpeedMax": 15.57,
},
{
"forecastStart": "2024-10-18T15:00:00Z",
"forecastEnd": "2024-10-19T15:00:00Z",
"conditionCode": "Drizzle",
"maxUvIndex": 5,
"moonPhase": "waningGibbous",
"moonrise": "2024-10-19T08:58:43Z",
"moonset": "2024-10-18T22:42:03Z",
"precipitationAmount": 3.85,
"precipitationChance": 0.76,
...
"windSpeedMax": 28.81,
},
...
]
}
}
Example from Germany where the fullmoon is skipped:
{
"forecastDaily": {
"name": "DailyForecast",
"metadata": {
"attributionURL": "https://developer.apple.com/weatherkit/data-source-attribution/",
"expireTime": "2024-10-21T15:41:17Z",
"latitude": 47.760,
"longitude": 12.650,
"readTime": "2024-10-21T14:41:17Z",
"reportedTime": "2024-10-21T13:00:37Z",
"units": "m",
"version": 1,
"sourceType": "modeled"
},
"days": [
{
"forecastStart": "2024-10-16T22:00:00Z",
"forecastEnd": "2024-10-17T22:00:00Z",
"conditionCode": "MostlyClear",
"maxUvIndex": 3,
"moonPhase": "waxingGibbous",
"moonrise": "2024-10-17T16:07:30Z",
"moonset": "2024-10-17T05:19:30Z",
"precipitationAmount": 0.0,
...
"windSpeedMax": 8.23,
},
{
"forecastStart": "2024-10-17T22:00:00Z",
"forecastEnd": "2024-10-18T22:00:00Z",
"conditionCode": "Cloudy",
"maxUvIndex": 2,
"moonPhase": "waningGibbous",
"moonrise": "2024-10-18T16:30:22Z",
"moonset": "2024-10-18T06:48:39Z",
"precipitationAmount": 1.17,
...
"windSpeedMax": 8.73,
},
{
"forecastStart": "2024-10-18T22:00:00Z",
"forecastEnd": "2024-10-19T22:00:00Z",
"conditionCode": "Cloudy",
"maxUvIndex": 2,
"moonPhase": "waningGibbous",
"moonrise": "2024-10-19T16:59:14Z",
"moonset": "2024-10-19T08:18:33Z",
"precipitationAmount": 0.02,
...
"windSpeedMax": 7.16,
},
]
}
}
As you can see here https://moon.nasa.gov/moon-observation/daily-moon-guide/?intent=011#1729171951907::0:: and on several other sites specialized on the lunar cycle) on 2024-10-17 should be shown full moon.
I know this error is probably because the forecast starts prior to the full moon phase and ends after it but customers don't care about technicalities. They see that there is a full moon missing and complain to me. And they are right. Can you fix this somehow? For example, if a DailyForecast spans the majority of a full moon this Day is marked as full moon.
Another question: Are you considering providing a moonPhase attribute to the "currentWeather" dataset? That would be the best option. (At least for me :))
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"}
My Weather beach app displays the time according to the country in the weather link under iOS 17 but not under IOS 18
NSTimeZone.resetSystemTimeZone() is no longer supported by IOS 18 or it is a bug
I keep getting severe weather warnings in CA but I’m in NY. I have checked my locations and I have no CA weather requests selected. I clicked on the alert and it said it was from weatherkit. How do I make these CA go away for good? Thanks!
Over 1 month ago I was in Los Angles with my iPhone 15 Pro Max running iOS 18.1. Since then, I have returned and am getting weather alerts on a daily basis weather warning despite me NOT having their weather displayed on my iPhone
Hi all
There is a weather alert for Manhattan New York (Coastal Flood Advisory) all weather apps give this info but Weatherkit doesn't include this alert data. Weatherkit api team improved my skill for testing apps with creating random issue...
With the introduction of the Tides app in watchOS 11, users can now view information about tides and swells along the coast. Is this data accessible to developers via WeatherKit?
In the Tides app, the data source for tides and weather is shown as WeatherKit.
Hi there!
The parameter AreaName is not present in the WeatherAlertSummary object received via the API.
But here it is showing up: https://weatherkit.apple.com/alertDetails/index.html?ids=708c32b5-e760-5fb3-9c47-68394e07353a&lang=de-DE&timezone=Europe/Berlin
It worked for a couple of month now and suddenly it disappeared.
I've noticed in the past few weeks that the minutely precipitation values reported by WeatherKit are much bigger than they were before. Specifically I'm referring to WeatherKit.MinuteWeather.precipitationIntensity.
In my app, I convert to mm per hour:
let mmPerHour = $0.precipitationIntensity.converted(to: UnitSpeed.kilometersPerHour).value * 1e6
This has worked perfectly since WeatherKit came out, but now when I look at rainy locations and compare with the built-in Apple Weather app on my phone, it seems that the new values are about 3x what they should be. I have checked this in multiple locations across the USA.
My intuition says this is an inches/cm conversion issue (2.54x). Is this an intentional change in WeatherKit that requires me to update my app, or is this a bug on Apple's end??
Weatherkit service works at some places and doesnt work other places. I have tried via vpn and I can see still working at USA but not working some part of europe
Hello, is there any rough timeframe of when we can expect MonthPrecipitationStatistics to be fully populated with WeatherKit?
averagePrecipitationAmount is being returned. averagePrecipitationProbability and averageSnowfallAmount are not and are always zero.
I did file FB14326506 about this.