I've tried to find the solution to my issue on this forum and general web searches. I see a lot of similar issues but no clear advice how to answer.
I have some fairly simple code to get a .daily historical weather object as below:
var gameLocation: CLLocation = CLLocation()
switch game.country {
case .us:
gameLocation = CLLocation(latitude: homeTeam.sFactors.gpsCoord.lat, longitude: homeTeam.sFactors.gpsCoord.long)
case .germany:
gameLocation = CLLocation(latitude: GameCountry.germany.gpsCoord.lat, longitude: GameCountry.germany.gpsCoord.long)
case .uk:
gameLocation = CLLocation(latitude: GameCountry.uk.gpsCoord.lat, longitude: GameCountry.uk.gpsCoord.long)
case .mexico:
gameLocation = CLLocation(latitude: GameCountry.mexico.gpsCoord.lat, longitude: GameCountry.mexico.gpsCoord.long)
}
var gameStartDate: Date = Date()
do {
gameStartDate = try DateRelatedHelpers().convertISO8601StringToDate(from: game.date)
print("Date string: \(game.date), Date: \(gameStartDate)")
} catch {
throw DateHelperError.invalidDateString
}
let gameEndDate = Calendar.current.date(byAdding: .day, value: 1, to: gameStartDate)!
let gameWeather = try! await weatherService.weather(for: gameLocation, including: .daily(startDate: gameStartDate, endDate: gameEndDate))
I call the function from a loop which is going through several different locations to fetch. I get some valid responses then I receive the following error:
Received invalid http response code 404 for request: C2A50990-2E03-497B-BC48-EF7560524E00
Encountered an error when fetching weather data subset; location=<+39.27745100,-76.62297400> +/- 0.00m (speed -1.00 mps / course -1.00) @ 1/24/24, 8:32:28 PM Central Standard Time, error=responseFailed: 404 WeatherDaemon.WDSClient<WeatherDaemon.WeatherResource>.Errors.responseFailed(<NSHTTPURLResponse: 0x6000003d5dc0> { URL: https://weather-data.apple.com/v3/weather/en-US/39.277/-76.623?timezone=America/New_York&dataSets=forecastDaily&dailyStart=2023-09-10T17:00:00Z&dailyEnd=2023-09-11T17:00:00Z&country=US&deviceLanguages=en-US&clientMetadata=CgJVUxoFZW4tVVNKAFABWBRgA4ABA5gBALoBAhAB4gEICgseHR8hICLyAQJVUw } { 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, 25 Jan 2024 02:32:29 GMT"
);
Expires = (
"Thu, 25 Jan 2024 02:32:29 GMT"
);
Pragma = (
"no-cache"
);
Server = (
Apple
);
"Strict-Transport-Security" = (
"max-age=31536000; includeSubdomains"
);
"X-Apple-Origin" = (
"f6fe362e-be7c-35f4-b131-3b1f903b4bca"
);
"X-Cache" = (
"TCP_MISS from a184-28-40-133.deploy.akamaitechnologies.com (AkamaiGHost/11.4.0-53477943) (-)"
);
"X-Content-Type-Options" = (
nosniff
);
"X-Frame-Options" = (
SAMEORIGIN
);
"X-REQUEST-ID" = (
"C2A50990-2E03-497B-BC48-EF7560524E00"
);
"X-XSS-Protection" = (
"1; mode=block"
);
} }, Optional(""))
I also get this warning on any call that receives data:
Aborting silent interpolation: additional missing products that need to be fetched from the server anyway; location=CLLocationCoordinate2D(latitude: 39.277451, longitude: -76.622974), missing products=[WeatherDaemon.WeatherProduct.forecastDaily]
My dates are in UTC time. I assume the calls return data in the local time of the location. Could this be an issue with Dates (i.e. local vs location date)?
Any assistance would be appreciated.