Post

Replies

Boosts

Views

Activity

Reply to dateSet forecastDaily always returning 404 for past 12 hours has been working for months
Today (12/16/23), I began getting this same 404 error in my code. I also was using code that had been working for the last month or more. I was requesting forecast data for the date range starting at the current time and going until 10 days in the future from the current time. When I switched my code to request forecast data from the beginning of the day until ten days from the beginning of the day, the 404 error went away. So I was experiencing the same error that moscarillo was experiencing, and I was able to fix it by following the advice given by the Apple Frameworks Engineer. fwiw, here is the code that is working for me now:             let startOfToday = Calendar.current.startOfDay(for: Date())             let startDate = Calendar.current.date(byAdding: DateComponents(day: -10), to: startOfToday)!             let endDate = Calendar.current.date(byAdding: DateComponents(day: 10), to: startOfToday)!             let current: CurrentWeather             let futureDaily: Forecast<DayWeather>             let futureHourly: Forecast<HourWeather>             let alerts: [WeatherAlert]?             let historicDaily: any Collection<DayWeather>             let historicHourly: any Collection<HourWeather>             (current,              futureDaily,              futureHourly,              alerts) = try await self.weather(for: location,                                               including: .current,                                               .daily(startDate: startOfToday, endDate: endDate),                                               .hourly(startDate: startOfToday, endDate: endDate),                                               .alerts)
Feb ’23