Thanks for sharing! I have seemingly ran into the same issue, with - of all places - Apple Park, Cupertino... The following code fails with status 404. It seems that trying to get any history before that date fails too, whereas getting the history after that date succeeds.
settings.startDate = Calendar.current.date(from: .init(
timeZone: .init(identifier: "America/Los_Angeles"),
year: 2023,
month: 9,
day: 27,
hour: 0,
minute: 0,
second: 0
))!
settings.endDate = Calendar.current.date(from: .init(
timeZone: .init(identifier: "America/Los_Angeles"),
year: 2023,
month: 9,
day: 28,
hour: 0,
minute: 0,
second: 0
))!
settings.locationLatitude = 37.334886
settings.locationLongitude = -122.008988
let location = CLLocation(latitude: settings.locationLatitude, longitude: settings.locationLongitude)
do {
let dayWeather = try await WeatherService.shared.weather(
for: location,
including: .daily(startDate: settings.startDate,
endDate: settings.endDate))
print("Received \(dayWeather.count) DayWeather object(s).")
} catch {
print("WeatherKit Error: \(error.localizedDescription)")
throw error
}