WeatherKit

RSS for tag

Bring 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
Sort by:

Post

Replies

Boosts

Views

Activity

WeatherKit REST API does not return daily forecast data for over 9 days
Upon requesting forecast data for more than 9 days, the API would return "400 Bad Request". Here are some values I tried (as of 2024-07-02T15:00:00Z): (dailyStart is in past) dailyStart=2024-07-01T15:00:00Z dailyEnd=2024-07-11T15:00:00Z expected= 10 days forecast actual= 10 days forecast (dailyStart is current date, forcecast > 9 days) fails dailyStart=2024-07-02T15:00:00Z dailyEnd=2024-07-12T15:00:00Z expected= 10 days forecast actual= 400 Bad Request (dailyStart is current date, forecast <= 9 days) dailyStart=2024-07-02T15:00:00Z dailyEnd=2024-07-11T15:00:00Z expected= 9 days forecast actual= 9 days forecast (no values passed) fails dailyStart= dailyEnd= expected= 10 days forecast actual= 9 days forecast The official documentation says: dailyEnd: The time to end the daily forecast. If this parameter is absent, daily forecasts run for 10 days. dailyStart: The time to start the daily forecast. If this parameter is absent, daily forecasts start on the current day. This started happening sometime last week. Would someone please tell me what changed with the API? Thank you.
0
1
45
15h
Weatherkit temperature way off
My app AirCompare is a smart home controller and makes system decisions based on local weather. Users have been seeing absurdly wrong (~10°F off) current temperatures, and of course that's a problem. I've seen similar complaints on Reddit and one poster claims that Apple switched from whatever DarkSky was using (which seemed accurate) to a predictive model from IBM. Compare iOS15 to iOS16 and you may see a large discrepancy in the Weather app. As a developer needing an accurate current temperature, I'm wondering if this is a temporary problem or whether we can expect this to continue going forward. If it's the latter, I'll need to find something more reliably accurate.
0
0
79
1w
WeatherKit REST API down?
I'm just getting 400 error responses to my requests sent to the WeatherKit REST API... haven't changed anything in my code for months. Here is the verbose output from curl: # curl -v "https://weatherkit.apple.com/api/v1/weather/en/51.5203/-0.1775?dataSets=forecastHourly%2CforecastNextHour&hourlyEnd=2024-07-04T09%3A03%3A36.962Z&hourlyStart=2024-06-24T09%3A03%3A36.962Z" -H "Authorization: Bearer [REDACTED]" * Trying 23.73.4.202:443... * Connected to weatherkit.apple.com (23.73.4.202) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * CAfile: /etc/ssl/certs/ca-certificates.crt * CApath: /etc/ssl/certs * TLSv1.0 (OUT), TLS header, Certificate Status (22): * TLSv1.3 (OUT), TLS handshake, Client hello (1): * TLSv1.2 (IN), TLS header, Certificate Status (22): * TLSv1.3 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS header, Finished (20): * TLSv1.2 (IN), TLS header, Supplemental data (23): * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): * TLSv1.2 (IN), TLS header, Supplemental data (23): * TLSv1.3 (IN), TLS handshake, Certificate (11): * TLSv1.2 (IN), TLS header, Supplemental data (23): * TLSv1.3 (IN), TLS handshake, CERT verify (15): * TLSv1.2 (IN), TLS header, Supplemental data (23): * TLSv1.3 (IN), TLS handshake, Finished (20): * TLSv1.2 (OUT), TLS header, Finished (20): * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): * TLSv1.2 (OUT), TLS header, Supplemental data (23): * TLSv1.3 (OUT), TLS handshake, Finished (20): * SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 * ALPN, server accepted to use http/1.1 * Server certificate: * subject: C=US; ST=California; O=Apple Inc.; CN=weather-data.apple.com * start date: May 8 16:30:14 2024 GMT * expire date: Nov 4 16:40:14 2024 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. * TLSv1.2 (OUT), TLS header, Supplemental data (23): > GET /api/v1/weather/en/51.5203/-0.1775?dataSets=forecastHourly%2CforecastNextHour&hourlyEnd=2024-07-04T09%3A03%3A36.962Z&hourlyStart=2024-06-24T09%3A03%3A36.962Z HTTP/1.1 > Host: weatherkit.apple.com > User-Agent: curl/7.81.0 > Accept: */* > Authorization: Bearer [REDACTED] > * TLSv1.2 (IN), TLS header, Supplemental data (23): * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * TLSv1.2 (IN), TLS header, Supplemental data (23): * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * old SSL session ID is stale, removing * TLSv1.2 (IN), TLS header, Supplemental data (23): * Mark bundle as not supporting multiuse < HTTP/1.1 400 Bad Request < Server: Apple < Content-Length: 0 < 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: ed7d038c-ef82-61d8-a2cb-4522ff7d32ca < X-Apple-Origin: fdcbff05-73b4-3a53-948b-343caa55a40e < Date: Mon, 24 Jun 2024 09:18:00 GMT < X-Cache: TCP_MISS from a23-73-3-202.deploy.akamaitechnologies.com (AkamaiGHost/11.5.2-56655770) (-) < Connection: keep-alive < * Connection #0 to host weatherkit.apple.com left intact
6
1
227
6d
Will FlatBuffers API be made available?
In the WWDC 2024 session, "Bring context to today's weather", it was mentioned that the Swift API now uses FlatBuffers when downloading the weather data to the client device. Will Apple's API for FlatBuffers be made available to developers? If its already in the SDK (client side) it would seem a shame to have to include another framework that does the same thing.
3
0
123
1w
WeatherKit failures in last 24 hours
In the last 24 hours, I've noticed a huge increase in the number of connection failures to WeatherKit... more than half the calls are responding with responseFailed or -999 / -1001 errors. This is happening to customers in production, I have not managed to replicate the error on my own devices to get a complete error readout. Is anyone else experiencing this? System status shows green.
0
0
79
1w
WeatherKit, Apple Weather App outage right now? System status still green??
I've got an iOS app that uses WeatherKit SDK (not the REST API) to pull weather data. I'm getting reports from users today that it is failing to update today (June 5, 2024). When I run the app in a debugger I see: Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)" Received authentication failure for request: 5E11C6A7-C255-4130-B1C7-93C3D6935210 On another attempt I got a 504 response. The Apple Weather app is also extremely slow to update (if at all) when adding a new location. And of course, https://developer.apple.com/system-status/ shows WeatherKit with a green light. Is anyone else seeing this? Edit: There seems to be a broad outage with weatherkit. The apple weather app is not working for several people reported here: https://discussions.apple.com/thread/255637780?sortBy=best Why is the developer dashboard showing a green light?! We need to be able to rely on these systems.
3
2
322
3w
WeatherKit textual weather summary?
Is there a way out of the WeatherKit REST API to get a textual summary of the weather like the iPhone app from Apple shows? Right now the local forecast on the iPhone app says "Sunny conditions from 7pm-8pm, with partly cloudy conditions expected at 8PM". Is this something the app rolls on it's own or is there a attribute-value pair in one of the returned JSON datasets that has this text. It's not in the "forecastDaily" dataset. *Humorous that it says "Sunny conditions from 7pm-8pm" because that's about the time the sun is setting. That forecast was from 1PM.
1
0
209
3w
Why does the sample use Task.detached?
I was wondering if anyone knows why the sample project uses Task.detached everywhere because it seems highly non-standard, e.g. in ContentView: .task { Task.detached { @MainActor in await flightData.load() } } Instead, I would expect to see something like: .task { flightData = await controller.loadFlightData() } Or: .task { await controller.load(flightData: flightData) } Is the use of detached perhaps an attempt to work around some issue with ObservableObject published updates?
0
0
157
May ’24
WeatherKit - one "request" or two?
I have a Swift app that fetches current conditions and daily forecasts. It is in production and working without issues. My question is whether the fetch I am using counts as a single “request” for usage thresholds, or two (one for current conditions, one for daily forecast)? I need current conditions more often than daily forecast, so if this is counting as two requests, I could refactor the logic to get each separately as needed. But separating the requests would use more quota if the combined fetch counts as a single request. let service = WeatherService() let location = CLLocation(latitude: weatherData.lat, longitude: weatherData.lon) let startOfToday = Calendar.current.startOfDay(for: Date()) let endDate = Calendar.current.date(byAdding: DateComponents(day: 2), to: startOfToday)! let current: CurrentWeather let daily: Forecast<DayWeather> (current, daily) = try await service.weather(for: location, including: .current, .daily(startDate: startOfToday, endDate: endDate))
1
0
294
May ’24
WeatherKit API Timing Out
Has anyone else been experiencing issues with the WeatherKit API recently? Since Saturday we've been seeing about 1.5% of our requests time out. Apple hasn't posted anything on their status page https://developer.apple.com/system-status/ and the issue doesn't seem to be getting any better.
1
2
287
Apr ’24
Recurrent WeatherKit error {"reason": "NOT_ENABLED"}
We have been using the Weather Kit without any issues for the past year and a half. However, recently we have encountered a recurring problem with the WeatherKIT API. It has been responding with {"reason": "NOT_ENABLED"} for every request made. Last Saturday, I created a new Service ID, and it resolved the issue temporarily. However, today it started responding with {"reason": "NOT_ENABLED"} again. What steps should I take to resolve this issue?
1
0
319
Apr ’24
eriously wrong satellite positioning under Macos Sonoma 14.5(Macos Sonoma 14.5下严重错误的卫星定位)
My MacBook Air M2 system version macOS Sonoma 14.5 Beta (23F5049f) The error occurred: from the end of March 2024 to today (April 8, 24) Problem: The system positioning information is seriously wrong, including but not limited to: time zone, Safari, map app, weather app, search app... (PS. The positioning is correct when using Google Chrome and Google Maps, but it is still wrong when using Google Maps on Safari) Background: I came to Germany from mainland China at the end of March. The Apple ID region I use is Germany. The location of my iPhone and Apple Watch can be refreshed to Germany normally, and several of my AirTags have been refreshed to Germany. Tried but failed: I searched for some bash commands to try to clear and clear the cache of the map app and system location information. rm -rf ~/Library/Containers/com.apple.Maps rm -rf ~/Library/Application\ Support/com.apple.findmy sudo rm -rf /Library/Caches/com.apple.GeoServices sudo rm -rf /Library/Caches/com.apple.locationd defaults delete com.apple.locationd.plist Turn off location services in System Settings > Privacy and Security, shut down and restart the phone, and then turn the service back on. Turn my VPN on and off. Clear my network information. Since there are many files saved, the restore operation is not planned. 我的MacBook Air M2 系统版本macOS Sonoma 14.5 Beta版(23F5049f) 错误发生时间:2024年3月底到今天(24年4月8日) 问题:系统定位信息严重错误,包括但不限于:时区、Safari、地图app、天气app、查找app... (PS.使用Google Chrome浏览器与Google Maps时定位正确,Safari使用Google Maps仍然错误) 背景: 我从3月底从中国大陆来到欧洲德国。 我使用的Apple ID地区是德国的。 我的iPhone和Apple Watch定位能正常刷新到德国,且我几个AirTag已经刷新到德国。 尝试但都未成功: 我搜索了一些bash命令尝试清除、清空地图app和系统位置信息的缓存。 rm -rf ~/Library/Containers/com.apple.Maps rm -rf ~/Library/Application\ Support/com.apple.findmy sudo rm -rf /Library/Caches/com.apple.GeoServices sudo rm -rf /Library/Caches/com.apple.locationd defaults delete com.apple.locationd.plist 关闭系统设置>隐私与安全中的定位服务,关机重启,再重开这项服务。 开关我的VPN。 清除我的网路信息。 由于保存的文件较多,不打算进行还原操作。
1
0
453
Apr ’24
SwiftUI WeatherKit returns HTTP status code 403
Trying to get weather data for a specific location and specific timezone. Generated Service identifier and Private Key, from Apple developer site. Then Generated public key Generated jwt token from jwt.io by keying in the payload, header, public, and private key. Header { "alg" : "ES256", // predefined "kid" : “keyid” , // key id created for WeatherKit "id" : “developer_team_account_id.com.company_name.MyWeatherKit, "typ" : "JWT" } Payload { "iat" : 1710117942, "exp" : 1710204342, "iss" : "developer_team_account_id", "sub" : "com.company_name.MyWeatherKit } I Then call this function: func getWeatherData(requestId: String, latitudeStr: String, longitudeStr: String, completion: @escaping (Bool) -> () ){ var country = "US" var language = "en" var tz = "CST" let jwtToken = "token here...." let urlString:String = "https://weatherkit.apple.com/api/v1/availability/" + language + "/" + latitudeStr + "/" + longitudeStr + "?" + "country=" + country + "&" + "timezone=" + tz print("Apple weather urlString: \(urlString)") let weatherURL = URL(string: urlString) var request = URLRequest(url: weatherURL!) request.httpMethod = "GET" request.setValue("Bearer \(jwtToken)", forHTTPHeaderField: "Authorization") let dataTask = URLSession.shared.dataTask(with:weatherURL!) { [self] responseData, response, error in do { print(response as Any) print(error as Any) if let data = responseData { try DispatchQueue.main.sync { [unowned self] in let decoder = JSONDecoder() let jsonData = try decoder.decode(Top.self, from: data) // parse data here print(jsonData) completion(true) } } } catch { print("error: \(error.localizedDescription)") completion(false) } } dataTask.resume() } Gives response with code 403 Optional(<NSHTTPURLResponse: 0x280cbcf00> { URL: https://weatherkit.apple.com/api/v1/availability/en/29.928894042968750/-95.607747517125430?country=US&timezone=CST } { Status Code: 403, Headers { "Access-Control-Allow-Origin" = ( "*" ); Connection = ( close ); "Content-Security-Policy" = ( "default-src 'self';" ); Date = ( "Tue, 12 Mar 2024 02:52:18 GMT" ); Server = ( Apple ); "Strict-Transport-Security" = ( "max-age=31536000; includeSubdomains" ); "X-Cache" = ( "TCP_MISS from a23-38-189-78.deploy.akamaitechnologies.com (AkamaiGHost/11.4.3-54729273) (-)" ); "X-Content-Type-Options" = ( nosniff ); "X-Frame-Options" = ( SAMEORIGIN ); "X-REQUEST-ID" = ( "bac7e5dc-c5fd-6f85-263b-8f59b169cd2f" ); "X-XSS-Protection" = ( "1; mode=block" ); } }) The URL I am passing is : https://weatherkit.apple.com/api/v1/availability/en/29.928894042968750/-95.607747517125430?country=US&timezone=CST Am I calling the wrong URL? Or is Apple weather service down? I am at a loss to understand. I need some help and guidance
0
0
339
Mar ’24
WeatherKit Historical Data Availability
Hello, Our team is leveraging WeatherKit for our product, with requirements to obtain historical, current, and forecasted weather data. Our research indicates that WeatherKit supports all these needs, albeit with a caveat regarding historical data. According to this discussion on the developer forums, historical data should be available post-August 2021. However, we've encountered issues accessing historical data for certain locations beyond this date. Are these gaps in data availability a known issue within WeatherKit's service? If so, could you provide any insights into when we might expect a resolution? Thank you for your assistance.
1
1
495
Mar ’24
WeatherKit always fails with 404 for specific lat/long/dates with forecastDaily
We have an app that allows users to fetch historical weather data for their selected locations. We are seeing users report failures for specific latitudes and longitudes that come back as WeatherDaemon.WDSClient<WeatherDaemon.WeatherResource>.Errors.responseFailed For example, this request always fails: https://weather-data.apple.com/v3/weather/en-US/33.797/-111.775?timezone=America/Phoenix&dataSets=forecastDaily&dailyStart=2023-12-29T07:00:00Z&dailyEnd=2023-12-31T07:00:00Z&country=US&deviceLanguages=en-US&clientMetadata=<REDACTED> Another example for another location: https://weather-data.apple.com/v3/weather/en-AU/40.717/-74.000?timezone=America/New_York&dataSets=forecastDaily&dailyStart=2023-12-29T05:00:00Z&dailyEnd=2023-12-30T05:00:00Z&country=US&deviceLanguages=en-AU,es-AU&clientMetadata=<REDACTED> Both example involve queries at the end of December 2023. I have filed this as FB13608710 with example code that replicates this as it is being used in our app.
4
0
724
Mar ’24
Historical weather from WeatherKit and Date confusion
I've tried to find the solution to my issue on this forum and general web searches. I see a lot of similar issues but no clear advice how to answer. I have some fairly simple code to get a .daily historical weather object as below: var gameLocation: CLLocation = CLLocation() switch game.country { case .us: gameLocation = CLLocation(latitude: homeTeam.sFactors.gpsCoord.lat, longitude: homeTeam.sFactors.gpsCoord.long) case .germany: gameLocation = CLLocation(latitude: GameCountry.germany.gpsCoord.lat, longitude: GameCountry.germany.gpsCoord.long) case .uk: gameLocation = CLLocation(latitude: GameCountry.uk.gpsCoord.lat, longitude: GameCountry.uk.gpsCoord.long) case .mexico: gameLocation = CLLocation(latitude: GameCountry.mexico.gpsCoord.lat, longitude: GameCountry.mexico.gpsCoord.long) } var gameStartDate: Date = Date() do { gameStartDate = try DateRelatedHelpers().convertISO8601StringToDate(from: game.date) print("Date string: \(game.date), Date: \(gameStartDate)") } catch { throw DateHelperError.invalidDateString } let gameEndDate = Calendar.current.date(byAdding: .day, value: 1, to: gameStartDate)! let gameWeather = try! await weatherService.weather(for: gameLocation, including: .daily(startDate: gameStartDate, endDate: gameEndDate)) I call the function from a loop which is going through several different locations to fetch. I get some valid responses then I receive the following error: Received invalid http response code 404 for request: C2A50990-2E03-497B-BC48-EF7560524E00 Encountered an error when fetching weather data subset; location=<+39.27745100,-76.62297400> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/24/24, 8:32:28 PM Central Standard Time, error=responseFailed: 404 WeatherDaemon.WDSClient<WeatherDaemon.WeatherResource>.Errors.responseFailed(<NSHTTPURLResponse: 0x6000003d5dc0> { URL: https://weather-data.apple.com/v3/weather/en-US/39.277/-76.623?timezone=America/New_York&dataSets=forecastDaily&dailyStart=2023-09-10T17:00:00Z&dailyEnd=2023-09-11T17:00:00Z&country=US&deviceLanguages=en-US&clientMetadata=CgJVUxoFZW4tVVNKAFABWBRgA4ABA5gBALoBAhAB4gEICgseHR8hICLyAQJVUw } { Status Code: 404, Headers { "Access-Control-Allow-Origin" = ( "*" ); "Cache-Control" = ( "max-age=0, no-cache, no-store" ); Connection = ( "keep-alive" ); "Content-Length" = ( 0 ); "Content-Security-Policy" = ( "default-src 'self';" ); Date = ( "Thu, 25 Jan 2024 02:32:29 GMT" ); Expires = ( "Thu, 25 Jan 2024 02:32:29 GMT" ); Pragma = ( "no-cache" ); Server = ( Apple ); "Strict-Transport-Security" = ( "max-age=31536000; includeSubdomains" ); "X-Apple-Origin" = ( "f6fe362e-be7c-35f4-b131-3b1f903b4bca" ); "X-Cache" = ( "TCP_MISS from a184-28-40-133.deploy.akamaitechnologies.com (AkamaiGHost/11.4.0-53477943) (-)" ); "X-Content-Type-Options" = ( nosniff ); "X-Frame-Options" = ( SAMEORIGIN ); "X-REQUEST-ID" = ( "C2A50990-2E03-497B-BC48-EF7560524E00" ); "X-XSS-Protection" = ( "1; mode=block" ); } }, Optional("")) I also get this warning on any call that receives data: Aborting silent interpolation: additional missing products that need to be fetched from the server anyway; location=CLLocationCoordinate2D(latitude: 39.277451, longitude: -76.622974), missing products=[WeatherDaemon.WeatherProduct.forecastDaily] My dates are in UTC time. I assume the calls return data in the local time of the location. Could this be an issue with Dates (i.e. local vs location date)? Any assistance would be appreciated.
1
0
401
Jan ’24
Need strategy for using WeatherKit in the background
I asked a similar question a while back: https://developer.apple.com/forums/thread/730946 Since then I have a new Mac and new iPhone and so I now have the hardware to actually play with WeatherKit. I've worked my way past all the entitlements stuff and have been able to use and expand on online examples. Cool. Trouble is, nearly every example you can find uses code designed to update the UI as fresh weather data is fetched. My app currently uses background URL fetches to obtain weather data, make some calculations and take appropriate actions, all in the background. Updating the UI was a separate challenge. So which asynchronous tool is the right one for this? How can I quickly update my existing code to call WeatherKit instead of going to a weather site for a download? I currently use something like a download task session: let weatherTask = session.downloadTask (with: URL(string: urlString)!) weatherTask.taskDescription = "weather" weatherTask.resume() or a dataTask session: var request = URLRequest(url: url) request.httpMethod = "GET" request.addValue("text/html", forHTTPHeaderField: "Content-Type") let taskWeatherPOP = URLSession.shared.dataTask(with: request) { (data, response, error) in if error != nil { print("Error is \(String(describing: error))") } if let POPData = data, let report = String(data: POPData, encoding: String.Encoding.utf8) { if weatherReportPOP.contains("ServiceUnavailable") { print("A Weather POP report error") } else { weatherReportPOP = report } // Close the IF service unavailable } // Closes the IF weather data is not nil } // Close Task Weather taskWeatherPOP.resume()
1
0
549
Jan ’24