MinuteWeather always returns nil

Has anyone else been able to retrieve weather data from MinuteWeather? Specifically, I'm looking to access summary, but MinuteWeather always returns nil and the WeatherAvailability check for it returns unsupported. I know it's not location based since I'm testing with the same locations I've used previously with the Dark Sky API (where minutely was available).

Example call:

let latitude = 37.323
let longitude = 122.032

Task {
    let weatherData = WeatherData.shared
    let minutely = await weatherData.minutelyForecast(for: CLLocation(latitude: latitude, longitude: longitude))
        
    guard let minutelyWeather = minutely else {
      print("WeatherKit minutely data unavailable")
      return
    }

    // ...
}

WeatherData class:

class WeatherData: NSObject {

    static let shared = WeatherData()
    private let service = WeatherService.shared

    func minutelyForecast(for location: CLLocation) async -> WeatherKit.Forecast<MinuteWeather>? {

        let minuteWeather = await Task.detached(priority: .userInitiated) {

            let forecast = try? await self.service.weather(for: location, including: .minute)

            return forecast

        }.value

        return minuteWeather
    }
}
Post not yet marked as solved Up vote post of Insleep Down vote post of Insleep
765 views

Accepted Reply

In your example code, you probably mean -122.032, which would be in Cupertino (where we have next-hour precipitation) instead of somewhere in China (where we do not). Assuming that’s the case, you’re probably running into a known issue we discovered with MinuteWeather that should be resolved in an upcoming seed.

  • Yes, correct, I did mean to add the negative (in my actual project I am using Location Services so the lat/long in this post are just for context). Thanks for the update, I'll wait for the next beta and retest.

Add a Comment

Replies

In your example code, you probably mean -122.032, which would be in Cupertino (where we have next-hour precipitation) instead of somewhere in China (where we do not). Assuming that’s the case, you’re probably running into a known issue we discovered with MinuteWeather that should be resolved in an upcoming seed.

  • Yes, correct, I did mean to add the negative (in my actual project I am using Location Services so the lat/long in this post are just for context). Thanks for the update, I'll wait for the next beta and retest.

Add a Comment