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

68 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

WeatherKit Historical Data
Hi, We have been using DarkSky's API for a few years now and we've always been able to pull data for at least 3 years prior to the current date. With WeatherKit, we are seeing that data is only available for the last 2 years. I've seen a few posts confirming this, but I'm curious if we will always be limited to 2 years of data or if this is a temporary situation and as time goes on, WeatherKit will have more and more historical data available? Another way to put it is will Apple always delete any data older than 2 years or will they start to build up an archive so in 10 years from now, they will have 12 total years of data (given they have 2 years right now). Thanks!
1
0
480
Sep ’23
WeatherKit Preflight Check fails
I created my own service to generate a JWT for WeatherKit. When I use this JWT in Postman it works as expected. However, if I use it in my React application I get a 403 CORS pre-flight check error. What this essentially means is by nature, Safari - before doing the GET call with Authorization header - it does a preflight check OPTIONS call without headers, to check if the service will accept the request. Unfortunately this generates a 403 error instead of an 200, so the GET Call with Authorization header cannot be made. Is this by design to prevent webfrontends from accessing the API or is this a bug I encountered? Thank you!
0
0
381
Sep ’23
clarification on precipitationItensity/precipitationChance
I've received a forecast with non-zero precipitationChance and zero precipitationIntensity. Is this expected? How should I interpret the data? { "forecastStart": "2023-09-02T02:00:00Z", "cloudCover": 0.55, "conditionCode": "PartlyCloudy", "daylight": false, "humidity": 0.92, "precipitationAmount": 0, "precipitationIntensity": 0, "precipitationChance": 0.31, "precipitationType": "clear", "pressure": 1017.56, "pressureTrend": "steady", "snowfallIntensity": 0, "snowfallAmount": 0, "temperature": 12.56, "temperatureApparent": 12.22, "temperatureDewPoint": 11.26, "uvIndex": 0, "visibility": 23505.2, "windDirection": 233, "windGust": 6.17, "windSpeed": 2.82 }
0
0
383
Aug ’23
Hourly history with WeatherKit REST API
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.
11
4
4.5k
Aug ’23
WeatherKit REST API 401 Unauthorized {reason:NOT_ENABLED}
Hello - migrated from darksky to WeatherKit in April of this year. With some difficulty finally got the REST API to work via the following resources: https://developer.apple.com/weatherkit/get-started/ which is horribly inadequate for JWT instructions. So i also used: https://dev.iachieved.it/iachievedit/weatherkit-rest-api/ which was quite helpful. As stated, in April i managed to get this working. About a week ago it stopped working. The response from my calls are 401 Unauthorized in the header and { "reason": "NOT_ENABLED" } in the body. I believe the key i created expired and thus WeatherKit stopped responding. So i tried to re-enable access using the same Apple key and a new JWT signature. That did not seem to work, so i removed the old key and created a new one. Downloaded the p8 file and used openssl on my ubuntu server to create pem and pub files for the jwt token. Still nothing. I have tried almost all combinations of keys and ID #s in the JWT.io console that i can think of. Importantly, nowhere in the official Apple documentation does it say what parameters the key creation and expiry dates can be. Does the key creation date have to match the date the key was created in Apple Developer Console??? What expiry dates are valid???? No idea. I have submitted a code level request, but they punted me to feedback which apparently does nothing. Still no resolution, nor have i been contacted once by an Apple representative. This is what my $200 developer fee gets me?! Unacceptable. If anyone has any idea on how to resolve this issue and/or create valid jwt tokens easier (via PHP preferably), i'm all ears. Thanks, airyt
1
1
876
Aug ’23
WeatherKit Swift / REST mismatch? daytimeForecast and overnightForecast not available via Swift?
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?
2
0
1.6k
Jul ’23
Use WeatherKit in an Xcode playground?
Can it be done? I can reliably crash Xcode by attempting the following in a playground: import UIKit import WeatherKit import CoreLocation let sanFrancisco = CLLocation(latitude: 37.7749, longitude: 122.4194) let weatherService = WeatherService() let weather = try await weatherService.weather(for: sanFrancisco) let temperature = weather.currentWeather.temperature print(temperature) Xcode 14.3.1 macOS 13.4.1
8
1
960
Jul ’23
WeatherKit in a background operation?
Sorry if this is a stupid question but I haven't been able to find any information on whether an app can request and receive weatherKit data - the weather - while in the background. My app (AirCompare) makes extensive use of background URL sessions to fetch and process weather data. If certain conditions are met, a notification alert is sent to the user so the user can decide whether to activate the app. For instance if rain is in the forecast, the app alerts the user that they might want to close their windows. Making the app active will execute HomeKit control and accomplish that. Will I be able to replace the background URL session with the appropriate code and be able to fetch weather data in the background?
2
0
821
Jul ’23
Cannot infer contextual base in reference to member 'fractionLength'
I am trying to format a measurement in my application as described in this documentation. Notice the example code: let temp = Measurement<UnitTemperature>(value: 38, unit: .celsius) let formattedTemp = temp.formatted(.measurement(width: .wide, usage: .weather, numberFormat: .numeric(precision: .fractionLength(1)))) // For locale: en_US: 100.4 degrees Fahrenheit When I try to do the same, I receive the following errors: Cannot infer contextual base in reference to member 'fractionLength' Cannot infer contextual base in reference to member 'numeric' Extra argument 'numberFormat' in call My code is as follows: Text("\(current.temperature.formatted(.measurement(width: .wide, usage: .weather, numberFormat: .numeric(precision: .fractionLength(1)))))") Where current is a CurrentWeather type provided by WeatherKit. Why is my adherence to the documentation causing these errors?
1
0
642
Jul ’23
Does Weatherkit have a webhook for push notifications?
I'm implementing PUSH NOTIFICATIONS for an app that uses Weatherkit ("there is a Tornado outside your house, run!") I enabled the capability, the code in app delegate, tested the push notification with the new apple console. and everything WORKS, BUT...how can I receive push notifications from Weather kit? do they have a webhook that I can listen to? I cannot find anything in the documentation. https://developer.apple.com/documentation/weatherkitrestapi/get_api_v1_weatheralert_language_id or do I need to create a server to call weatherkit every min? I don't understand how to listen to weather kit for alerts. thanks
0
0
578
Jun ’23