Weather Kit is not returning historical data

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?

Post not yet marked as solved Up vote post of Jklr Down vote post of Jklr
1.4k views
  • Did you ever get this resolved? I get an error when trying to run it. I can get current weather but historical weather crashes.

Add a Comment

Replies

same here. I am using the REST API and dailyStart and dailyEnd does nothing.. I can get the current weather but no luck with any of the historical data.

Anyone has an answer to when this might get fixed?

Yeah - we are having the same problem. Current weather is fine. Historical returns an empty data array.

I have a similar issue but I have gotten a step further. I am using a call similar to the one posted by @Jklr above. I am using this:

let weather = try await weatherService.weather(for: location, including: .daily(startDate: startDate, endDate: endDate))

When I try a date range greater than 10 days, I get an error. This, I suppose, makes sense since the docs say we are limited to pulling 10 days at a time. So I tried the call with a startDate of 5 days ago and an endDate of 1 day ago. This got me a bit further. I actually got some data! The returned the data is below:

days count=4, date range=2023-10-18 07:00:00 +0000 to 2023-10-21 07:00:00 +0000, first condition=Mostly Clear, first high=28.52 °C, first low=14.12 °C, last condition=Partly Cloudy, last high=19.17 °C, last low=13.05 °C

Question is - why does it not return data for each day in the requested date range? It only returns data for the startDate and the endDate - not the days in between. Is this how this is supposed to work? Shouldn't it return a list of dates with high and low temps for each day; not just the first and last conditions? Also - why is there a 10 day limit for historical data? I can understand a 10 day limit for future forecasts but why limit historical???

  • I am getting another "error" when running on a device (as opposed to the Canvas). I still get the same data as above (temps for startDate and endDate but not the days in between) along with this:

    Aborting silent interpolation: additional missing products that need to be fetched from the server anyway; location=CLLocationCoordinate2D(latitude: 37.77, longitude: -122.41), missing products=[WeatherDaemon.WeatherProduct.forecastDaily]
Add a Comment