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.

WeatherKit Documentation

Posts under WeatherKit tag

84 Posts
Sort by:
Post not yet marked as solved
11 Replies
4.3k Views
Has anyone figured out the correct incantation of request parameters to get historic hourly weather conditions from WeatherKit? I've tried every combo of hourlyStart, dailyStart, currentAsOf, etc with past dates and it seems like the oldest it will go back to is midnight for today. I would like to get the last 24 hours of conditions.
Posted
by
Post not yet marked as solved
2 Replies
1.1k Views
Hi, I'm in the process of developing a weather app using WeatherKit. Everything seems to be working fine in the Simulator, but when I put it on the device (iPhone 13 Pro Max) the temperature displays wrong. Example: On Simulator: 34 F On Device: 34.98 F Anyone else have this problem? Dan Uff
Posted
by
Post not yet marked as solved
3 Replies
1.4k Views
I'm trying to get historical data using the following syntax: try await service.weather(for: location, including: .daily(startDate: past1, endDate: past2)) Where past1 and past2 are two dates in the past (I checked their format and they are correct). I always get the same result, namely the 10 days default forecast you usually get calling service.weather(for: location) Am I missing something?
Posted
by
Post not yet marked as solved
3 Replies
1.6k Views
I have read the WeatherKit docs and watched the "Meet WeatherKit" WWDC video but it is not clear where the trademark and legal link need to be displayed. Can someone at Apple please clarify this. The docs state: "If your apps, web apps, or websites display any Apple weather data, you must clearly display the Apple Weather trademark, as well as the legal link to other data sources." I have a calendar style app on the App Store and want to incorporate weather data as simple icons into the day, week, month views with in the app. Is it ok to just display the trademark and legal link in the app's Settings view where a user would first turn on this weather feature? Or does it have to be displayed on every single view where weather data is displayed? Even if that data is just displaying a simple Sun or Cloud or Rain symbol to the user. Thanks.
Posted
by
Post not yet marked as solved
3 Replies
1.2k Views
I have added the WeatherKit capability and enabled it in the developer account for the respective app id. I continually get this error. Any ideas on how to fix this? Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors
Posted
by
Post not yet marked as solved
2 Replies
941 Views
Why does the documentation say this field returns the intensity of precipitation in UnitSpeed, this seems confusing. Shouldn't the amount of precipitation be an amount like inch/hr, mm/hr why would the value be in speed? The old dark sky documentation for this field shows the units were returned in inches/hour
Posted
by
Post not yet marked as solved
4 Replies
2.4k Views
I am working on an app that pulls data from weatherKit, including the conditionCode property, the content of which is displayed to the user. I wish to localize the data pulled from weatherKit but when pulling data from: weatherkit.apple.com/api/v1/weather/de/{latitude}/{longitude} The conditionCode and other strings is in english. Same is true if the language parameter is set to es, ja or something else. Am I doing something wrong or is localization yet to be supported in weatherKit? I can't find any documentation on this.
Posted
by
Post not yet marked as solved
5 Replies
1.3k Views
I have a problem with Weatherkit and recive data error with 2022-12-04 11:22:05.564713+0900 weatherProject[13140:412146] [WeatherDataService] Response did not contain requested dataset: .appLocationConfig. Returning default value: AppLocationConfig(reportAnIssue: ReportIssueLocationConfig(position: beforeFooter, minDaysSinceInteraction: 0), expireTime: 2022-12-04 02:52:05 +0000 func getCurrnetWeather(CLlocation: CLLocation, completion: @escaping () -> Void){ Task { do { let result = try await weatherService.weather(for: CLlocation) weather? = result } catch { print(error) } } } How Can I solve this problem? I Checked my account identifier. But still have problem...
Posted
by
Post marked as solved
2 Replies
1.2k Views
Until recently, I was unable to use WeatherKit to obtain historical Daily data. Now, it appears that I can retrieve Daily and Hourly historical data, but the returned data is limited to a ten day period. No matter what start and end dates are included, I get data from start date to 10 days later (assuming the end date was more than 10 days after the start). Is this a permanent restriction? Example: let historicalData = try await weatherService.weather(for: location, including: .daily(startDate: startDate, endDate: endDate))
Posted
by
Post marked as solved
2 Replies
1.5k Views
I am able to obtain daily forecasts via the REST API which include the daytimeForecast and overnightForecast records with their respective properties like cloudCover. So far I have failed to access them via the Swift API: forecast.daytimeForecast.cloudCover results in: "Value of type 'DayWeather' has no member 'daytimeForecast'". But if I print() the DayWeather objects, these members are actually printed with all their properties. Is there a way to get them I am overlooking?
Posted
by
Post not yet marked as solved
6 Replies
1.3k Views
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
Posted
by
Post not yet marked as solved
3 Replies
1.2k Views
When I'm using the following code into the simulator it gives the wanted result: Button {                 Task {                     localWeather = try await WeatherService.shared.weather(for: CLLocation(latitude: 52.5153, longitude: 6.08565), including:  .daily(startDate: Date(), endDate: Calendar.current.date(byAdding: .day, value: 1, to: Date())!)).first.debugDescription                 }             } label: {                 Text("Get the test weather")             }             Text(localWeather) When I'm using this exact code on a real device I get the following 404 error: [WeatherDataService] Received invalid http response code 404 for request: C7AEC7CC-E5F7-425D-8491-25B9302E2A0F:0 [WeatherService] Encountered an error when fetching weather data subset; location=<+52.51530000,+6.08565000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 05/01/2023, 13:55:53 Central European Standard Time,  error=responseFailed(<NSHTTPURLResponse: 0x282ce0260> { URL: https://weather-data.apple.com/v3/weather/en/52.515/6.086?timezone=Europe/Amsterdam&dataSets=forecastHourly,forecastDaily&dailyStart=2023-01-10T12:00:00Z&dailyEnd=2023-01-10T12:00:00Z&hourlyStart=2023-01-10T11:00:00Z&hourlyEnd=2023-01-10T16:00:00Z&country=NL } { 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, 05 Jan 2023 12:59:27 GMT"     );     Expires =     (         "Thu, 05 Jan 2023 12:59:27 GMT"     );     Pragma =     (         "no-cache"     );     Server =     (         "AppleHttpServer/21be5247c6351682d1d9aa22fe98c8f0d4902838"     );     "Strict-Transport-Security" =     (         "max-age=31536000; includeSubDomains",         "max-age=31536000"     );     "X-Apple-Origin" =     (         "bcd49c7f-c567-3921-a041-3d4ef58e5423"     );     "X-B3-TraceId" =     (         c8c6547722afc53f     );     "X-Cache" =     (         "TCP_MISS from a104-110-190-91.deploy.akamaitechnologies.com (AkamaiGHost/10.10.3-45298580) (-)"     );     "X-Content-Type-Options" =     (         nosniff     );     "X-Frame-Options" =     (         DENY     );     "X-REQUEST-ID" =     (         "407e37bc-ddf6-45fd-84d0-1d3d3b8651b0"     );     "X-XSS-Protection" =     (         "1; mode=block"     ); } }, Optional("")) I fixed it once by deleting Xcode and the app from my iPhone, but that doesn't work anymore. Any suggestions?
Posted
by
Post not yet marked as solved
4 Replies
1.1k Views
So, is the weatherAlerts field ever populated? From my (limited experience) it does not populate with current NWS alerts.
Posted
by
Post not yet marked as solved
1 Replies
571 Views
Hello. I noticed pretty early on that WeatherService.shared.weather seems to cache results. I realized this when I called it, killed network connectivity to my device, and then called it again I still got results back. My concern is about my widgets, which are also able to call WeatherService.shared.weather. I put my call inside of getTimeline(). After adding logging I realized that getTimeline() is called multiple times at the same time. For example, if I have two different widgets each with three different sizes (small, large, rectangular, etc) then six calls to getTimeline() are made for an update. I found a blog by Shopify iOS developers that describes how they found the same thing, but the forums aren't letting me link to their website's blog. My questions is which of these scenarios is happening: Even though WeatherService.shared.weather is called six times in the same second it's actually only the first call that goes out via the network and the remaining five calls just returned cached results. More than one of the six calls in the same second could be making a network call. If that's the case I'm going to need to add some form of throttling/caching because the number of free API calls per month is limited. Thank you!
Posted
by
Post not yet marked as solved
2 Replies
1k Views
We are seeing consistent 502 BAD GATEWAY errors from Weatherkit. Looking over the stack trace we see Connection refused: weatherkit.apple.com/23.45.233.25:443. This doesn't happen to all of our requests so it seams like one of the WeatherKit IP addresses has some issues. Any one else effected by this?
Posted
by
Post not yet marked as solved
2 Replies
721 Views
Hi all. I am working on weatherkit rest api to integrate to my android app. As a Dark Sky api user I can get timezone of the location which is requested which provides by Dark Sky api by default. But as far as i see there is no data for timezone info in weatherkit rest api. As an example it is necessary for sunrise data and etc. I know getting device timezone is easiest way but it's possible that an user can request a location has different timezone. I wish rest api provide location's timezone by default.
Posted
by
mcy
Post not yet marked as solved
1 Replies
528 Views
If you haven't yet, submit your feedback to https://feedbackassistant.apple.com/new-form-response I found WeatherKit under iOS & iPadOS (scroll all the way down). Recent Similar Reports show as "None", so perhaps there hasn't been enough reports. Also, it's ridiculous Apple hasn't responded to any of the recent posts in this forum. 15 days left of support for Dark Sky and WeatherKit has been down for almost 2 days without any acknowledgement from Apple.
Posted
by
Post not yet marked as solved
1 Replies
518 Views
My SwiftUI weather app shows weather stats for the day that I'm pulling from DayWeather. I added wind speed to my app recently. I wanted to add Gusts but I hit a problem. Whenever I look at the results returned for DayWeather the "gust" inside of Wind is always nil. The iOS weather app includes gusts in a daily summary. For example, today for ****** River, OR it says "Wind is currently 15 mph from the southeast. Today, wind speeds are 8 to 26 mph, with gusts up to 50 mph." A query I just did to WeatherKit returned 18mph with compass direction SSE but nil for gusts. I've searched the documentation and I can't determine if this is working as designed or a bug.
Posted
by