Meet WeatherKit

RSS for tag

Discuss the WWDC22 Session Meet WeatherKit

Posts under wwdc2022-10003 tag

32 Posts

Post

Replies

Boosts

Views

Activity

WeatherKit weatherFor never returns
Hi, I'm trying to work with WeatherKit. I've added the capability to the App ID as well as the capabilities in Xcode. Still after more than a day, in simulator I get 401 error, and on device even stranger - there weatherFor function is called but NEVER returns or throws an exception. try { let weatherService = WeatherService() let weather = try await weatherService.weather(for: location) print(weather) //never gets called } catch { ... // never called on device, always called on simulator Any one has an idea how to get it to work?
0
0
1k
Jul ’22
Single query to get weather for multiple dates
Hi, I try to fetch weather information for multiple dates through a single query but I only get information for the first day. let today = Date() let tomorrow = Calendar.current.date(byAdding: DateComponents(day: 1), to: today)! let forecast = try? await WeatherService.shared.weather(for: location, including: .daily(startDate: today, endDate: tomorrow)) Can we get weather information for a range of day?
0
0
1.5k
Jul ’22
WeatherKit UV index is always returning 0
Hi, i've been playing with WeatherKit for the first 3 betas but each time I try to get the UV Index of a forecast I've got 0 as value. For example the hourly forecast of San Francisco at the time of writing is the following : Optional(WeatherKit.HourWeather(date: 2022-07-06 14:00:00 +0000, cloudCover: 0.98, condition: Drizzle, symbolName: "cloud.moon.rain", dewPoint: 21.87 °C, humidity: 0.95, isDaylight: false, precipitation: rain, precipitationChance: 0.44, precipitationAmount: 0.44 mm, snowfallAmount: 0.0 mm, pressure: 1000.93 mbar, pressureTrend: Steady, temperature: 22.67 °C, apparentTemperature: 24.89 °C, uvIndex: WeatherKit.UVIndex(value: 0, category: Low), visibility: 8977.97 m, wind: WeatherKit.Wind(compassDirection: South Southeast, direction: 151.0 °, speed: 32.34 km/h, gust: Optional(48.66 km/h)))) While the UV Index at the time from The Weather Network is supposed to be 4. I've got this issue since beta 1 and it's happening on every location I try. Is this happening as well to other people ? Is there anything on my side in term of configuration that I should do ?
3
0
1.3k
Jul ’22
Apple WeatherKit Attribution Question
The way I want to insert weather data is on a page that doesn't have a lot of space so I just wanted to put a text line that said " Weather: Clear with a High of 77 °F" or whatever the actual daily forecast is. Would that meet the attribution requirements? Additionally, with the link to other data sources does that have to be on the same page as the weather display or can I have it on my Help screen?
1
0
1.2k
Jul ’22
WeatherKit REST API for iOS 15 native app?
According to the WeatherKit Documentation It says To provide weather information to a web app or other platform, like Android, use the WeatherKit REST API. For native iOS, macOS, tvOS, and watchOS apps, use WeatherKit. is it possible to use The WeatherKit REST API on a iOS native app below iOS 16? I don’t see us being able to drop iOS 15 support for at least a year or so.
1
1
937
Jun ’22
Call WeatherService within SiriKit Intent Definition File
Hi all, WeatherKit is working fine within my contentView. I am trying to use the WeatherKit within SiriKit Intent Definition files. I am trying to call let weather = try! await weatherService.weather(for: location) How can I handle my SiriKit intent with the async/await function? Latitude and longitude (location) will be provided as input values from Shortcuts App. Thanks
1
0
1.3k
Jun ’22
WeatherKit - getting many errors including "The file “Weather” couldn’t be opened because you don’t have permission to view it."
I have upgraded from macOS 12.5.4 to macOS 13 Beta 1. Haven't done anything odd. I am attempting to use WeatherKit but I am getting a lot of (odd) errors: The sample can't access the ~/Library/Weather/ folder despite it being set to read for users, others and group. (I've since switched to read and write for all, but no dice). Lots of other odd errors. 2022-06-11 22:52:26.720487+0100 PlayWithWeatherKit[16282:277975] [WeatherService] Couldn't get access to the /Library/Weather directory for the geocode Store. error=Error Domain=NSCocoaErrorDomain Code=257 "The file “Weather” couldn’t be opened because you don’t have permission to view it." UserInfo={NSUserStringVariant=(     Folder ), NSURL=file:///Users/tarasis/Library/Weather, NSFilePath=/Users/tarasis/Library/Weather, NSUnderlyingError=0x6000013d4b70 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} PlayWithWeatherKit[16282:277975] [] networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at "/Library/Preferences/com.apple.networkd.plist", please add an exception. PlayWithWeatherKit[16282:277975] [] networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at "/Library/Preferences/com.apple.networkd.plist", please add an exception. PlayWithWeatherKit[16282:277975] [WeatherDataService] Failed to create the weather data store, error=cantOpen(message: "authorization denied", location: TeaDB.Database.Location.path("/Users/tarasis/Library/Weather/weather-data.db")) PlayWithWeatherKit[16282:277991] [Metadata] unable to get a dev_t for store 1795162192. PlayWithWeatherKit[16282:277991] [] nehelper sent invalid response: <dictionary: 0x1ffa87480> { count = 1, transaction: 0, voucher = 0x0, contents = "XPCErrorDescription" => <string: 0x1ffa87618> { length = 18, contents = "Connection invalid" } } PlayWithWeatherKit[16282:277991] [] nw_parameters_set_source_application_by_bundle_id_internal Failed to convert from bundle ID (net.tarasis.test.wwdc.Playground) to UUID. This could lead to wrong data usage accounting. PlayWithWeatherKit[16282:277991] [connection] nw_endpoint_flow_validate_delegation [C1 weather-data.apple.com:443 in_progress parent-flow (satisfied (Path is satisfied), interface: en0, ipv4, ipv6, dns)] Network Delegation Failure: Invalid Bundle ID "net.tarasis.test.wwdc.Playground" [M] PlayWithWeatherKit[16282:277991] [] nw_resolver_can_use_dns_xpc_block_invoke Sandbox does not allow access to com.apple.dnssd.service PlayWithWeatherKit[16282:277991] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:14 Err:-1 Errno:1 Operation not permitted PlayWithWeatherKit[16282:277991] [connection] nw_resolver_create_dns_service_locked [C1.1] DNSServiceCreateDelegateConnection failed: ServiceNotRunning(-65563) PlayWithWeatherKit[16282:277991] Connection 1: received failure notification PlayWithWeatherKit[16282:277991] Connection 1: failed to connect 10:-72000, reason -1 PlayWithWeatherKit[16282:277991] Connection 1: encountered error(10:-72000) PlayWithWeatherKit[16282:277975] Task <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1> HTTP load failed, 0/0 bytes (error code: -1003 [10:-72000]) PlayWithWeatherKit[16282:277975] Task <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1> finished with error [-1003] Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={_kCFStreamErrorCodeKey=-72000, NSUnderlyingError=0x6000013b0060 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: en0, ipv4, ipv6, dns, _kCFStreamErrorCodeKey=-72000, _kCFStreamErrorDomainKey=10}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(     "LocalDataTask <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1>" ), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=https://weather-data.apple.com/v2/token, NSErrorFailingURLKey=https://weather-data.apple.com/v2/token, _kCFStreamErrorDomainKey=10} PlayWithWeatherKit[16282:277975] [WeatherService] Encountered an error when fetching weather data subset; location=<+37.32299800,-122.03218100> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2022/06/11, 22:52:26 British Summer Time,  error=Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={_kCFStreamErrorCodeKey=-72000, NSUnderlyingError=0x6000013b0060 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: en0, ipv4, ipv6, dns, _kCFStreamErrorCodeKey=-72000, _kCFStreamErrorDomainKey=10}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(     "LocalDataTask <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1>" ), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=https://weather-data.apple.com/v2/token, NSErrorFailingURLKey=https://weather-data.apple.com/v2/token, _kCFStreamErrorDomainKey=10}
3
0
2.5k
Jun ’22
Convert from Fahrenheit to Celsius?
Hello Everyone, In the example code, I'm trying to convert from Fahrenheit to Celsius, but I'm not succeeding. Output is always in Fahrenheit. My code is this:   func formattedTemperature(_ temp: Measurement<UnitTemperature>) -> String {         let tempC = temp.converted(to: .celsius)         return tempC.formatted(.measurement(width: .abbreviated, usage: .weather))     } In the simulator I also went into the settings and switched in General->Language/Region from F to C. But this also had not effect. Would anyone have an idea how to correct this? Thanks and best regards, Patrick
1
0
1.7k
Jun ’22
WeatherKit weatherFor never returns
Hi, I'm trying to work with WeatherKit. I've added the capability to the App ID as well as the capabilities in Xcode. Still after more than a day, in simulator I get 401 error, and on device even stranger - there weatherFor function is called but NEVER returns or throws an exception. try { let weatherService = WeatherService() let weather = try await weatherService.weather(for: location) print(weather) //never gets called } catch { ... // never called on device, always called on simulator Any one has an idea how to get it to work?
Replies
0
Boosts
0
Views
1k
Activity
Jul ’22
WeatherKit Historical Data From Swift?
In the Meet WeatherKit video it is stated that "You can access historical data by specifying a start and end date to the hourly and daily requests.", but I'm not seeing a way to do that in the Swift API (I see it is there in the REST API). Am I missing something or is that just not implemented yet?
Replies
1
Boosts
3
Views
1.4k
Activity
Jul ’22
Single query to get weather for multiple dates
Hi, I try to fetch weather information for multiple dates through a single query but I only get information for the first day. let today = Date() let tomorrow = Calendar.current.date(byAdding: DateComponents(day: 1), to: today)! let forecast = try? await WeatherService.shared.weather(for: location, including: .daily(startDate: today, endDate: tomorrow)) Can we get weather information for a range of day?
Replies
0
Boosts
0
Views
1.5k
Activity
Jul ’22
WeatherKit UV index is always returning 0
Hi, i've been playing with WeatherKit for the first 3 betas but each time I try to get the UV Index of a forecast I've got 0 as value. For example the hourly forecast of San Francisco at the time of writing is the following : Optional(WeatherKit.HourWeather(date: 2022-07-06 14:00:00 +0000, cloudCover: 0.98, condition: Drizzle, symbolName: "cloud.moon.rain", dewPoint: 21.87 °C, humidity: 0.95, isDaylight: false, precipitation: rain, precipitationChance: 0.44, precipitationAmount: 0.44 mm, snowfallAmount: 0.0 mm, pressure: 1000.93 mbar, pressureTrend: Steady, temperature: 22.67 °C, apparentTemperature: 24.89 °C, uvIndex: WeatherKit.UVIndex(value: 0, category: Low), visibility: 8977.97 m, wind: WeatherKit.Wind(compassDirection: South Southeast, direction: 151.0 °, speed: 32.34 km/h, gust: Optional(48.66 km/h)))) While the UV Index at the time from The Weather Network is supposed to be 4. I've got this issue since beta 1 and it's happening on every location I try. Is this happening as well to other people ? Is there anything on my side in term of configuration that I should do ?
Replies
3
Boosts
0
Views
1.3k
Activity
Jul ’22
Apple WeatherKit Attribution Question
The way I want to insert weather data is on a page that doesn't have a lot of space so I just wanted to put a text line that said " Weather: Clear with a High of 77 °F" or whatever the actual daily forecast is. Would that meet the attribution requirements? Additionally, with the link to other data sources does that have to be on the same page as the weather display or can I have it on my Help screen?
Replies
1
Boosts
0
Views
1.2k
Activity
Jul ’22
WeatherKit REST API for iOS 15 native app?
According to the WeatherKit Documentation It says To provide weather information to a web app or other platform, like Android, use the WeatherKit REST API. For native iOS, macOS, tvOS, and watchOS apps, use WeatherKit. is it possible to use The WeatherKit REST API on a iOS native app below iOS 16? I don’t see us being able to drop iOS 15 support for at least a year or so.
Replies
1
Boosts
1
Views
937
Activity
Jun ’22
Call WeatherService within SiriKit Intent Definition File
Hi all, WeatherKit is working fine within my contentView. I am trying to use the WeatherKit within SiriKit Intent Definition files. I am trying to call let weather = try! await weatherService.weather(for: location) How can I handle my SiriKit intent with the async/await function? Latitude and longitude (location) will be provided as input values from Shortcuts App. Thanks
Replies
1
Boosts
0
Views
1.3k
Activity
Jun ’22
WeatherKit - getting many errors including "The file “Weather” couldn’t be opened because you don’t have permission to view it."
I have upgraded from macOS 12.5.4 to macOS 13 Beta 1. Haven't done anything odd. I am attempting to use WeatherKit but I am getting a lot of (odd) errors: The sample can't access the ~/Library/Weather/ folder despite it being set to read for users, others and group. (I've since switched to read and write for all, but no dice). Lots of other odd errors. 2022-06-11 22:52:26.720487+0100 PlayWithWeatherKit[16282:277975] [WeatherService] Couldn't get access to the /Library/Weather directory for the geocode Store. error=Error Domain=NSCocoaErrorDomain Code=257 "The file “Weather” couldn’t be opened because you don’t have permission to view it." UserInfo={NSUserStringVariant=(     Folder ), NSURL=file:///Users/tarasis/Library/Weather, NSFilePath=/Users/tarasis/Library/Weather, NSUnderlyingError=0x6000013d4b70 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} PlayWithWeatherKit[16282:277975] [] networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at "/Library/Preferences/com.apple.networkd.plist", please add an exception. PlayWithWeatherKit[16282:277975] [] networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at "/Library/Preferences/com.apple.networkd.plist", please add an exception. PlayWithWeatherKit[16282:277975] [WeatherDataService] Failed to create the weather data store, error=cantOpen(message: "authorization denied", location: TeaDB.Database.Location.path("/Users/tarasis/Library/Weather/weather-data.db")) PlayWithWeatherKit[16282:277991] [Metadata] unable to get a dev_t for store 1795162192. PlayWithWeatherKit[16282:277991] [] nehelper sent invalid response: <dictionary: 0x1ffa87480> { count = 1, transaction: 0, voucher = 0x0, contents = "XPCErrorDescription" => <string: 0x1ffa87618> { length = 18, contents = "Connection invalid" } } PlayWithWeatherKit[16282:277991] [] nw_parameters_set_source_application_by_bundle_id_internal Failed to convert from bundle ID (net.tarasis.test.wwdc.Playground) to UUID. This could lead to wrong data usage accounting. PlayWithWeatherKit[16282:277991] [connection] nw_endpoint_flow_validate_delegation [C1 weather-data.apple.com:443 in_progress parent-flow (satisfied (Path is satisfied), interface: en0, ipv4, ipv6, dns)] Network Delegation Failure: Invalid Bundle ID "net.tarasis.test.wwdc.Playground" [M] PlayWithWeatherKit[16282:277991] [] nw_resolver_can_use_dns_xpc_block_invoke Sandbox does not allow access to com.apple.dnssd.service PlayWithWeatherKit[16282:277991] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:14 Err:-1 Errno:1 Operation not permitted PlayWithWeatherKit[16282:277991] [connection] nw_resolver_create_dns_service_locked [C1.1] DNSServiceCreateDelegateConnection failed: ServiceNotRunning(-65563) PlayWithWeatherKit[16282:277991] Connection 1: received failure notification PlayWithWeatherKit[16282:277991] Connection 1: failed to connect 10:-72000, reason -1 PlayWithWeatherKit[16282:277991] Connection 1: encountered error(10:-72000) PlayWithWeatherKit[16282:277975] Task <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1> HTTP load failed, 0/0 bytes (error code: -1003 [10:-72000]) PlayWithWeatherKit[16282:277975] Task <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1> finished with error [-1003] Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={_kCFStreamErrorCodeKey=-72000, NSUnderlyingError=0x6000013b0060 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: en0, ipv4, ipv6, dns, _kCFStreamErrorCodeKey=-72000, _kCFStreamErrorDomainKey=10}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(     "LocalDataTask <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1>" ), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=https://weather-data.apple.com/v2/token, NSErrorFailingURLKey=https://weather-data.apple.com/v2/token, _kCFStreamErrorDomainKey=10} PlayWithWeatherKit[16282:277975] [WeatherService] Encountered an error when fetching weather data subset; location=<+37.32299800,-122.03218100> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2022/06/11, 22:52:26 British Summer Time,  error=Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={_kCFStreamErrorCodeKey=-72000, NSUnderlyingError=0x6000013b0060 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: en0, ipv4, ipv6, dns, _kCFStreamErrorCodeKey=-72000, _kCFStreamErrorDomainKey=10}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(     "LocalDataTask <0D654665-D88F-4C81-ABDA-FBFAAC0B01E5>.<1>" ), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=https://weather-data.apple.com/v2/token, NSErrorFailingURLKey=https://weather-data.apple.com/v2/token, _kCFStreamErrorDomainKey=10}
Replies
3
Boosts
0
Views
2.5k
Activity
Jun ’22
Convert from Fahrenheit to Celsius?
Hello Everyone, In the example code, I'm trying to convert from Fahrenheit to Celsius, but I'm not succeeding. Output is always in Fahrenheit. My code is this:   func formattedTemperature(_ temp: Measurement<UnitTemperature>) -> String {         let tempC = temp.converted(to: .celsius)         return tempC.formatted(.measurement(width: .abbreviated, usage: .weather))     } In the simulator I also went into the settings and switched in General->Language/Region from F to C. But this also had not effect. Would anyone have an idea how to correct this? Thanks and best regards, Patrick
Replies
1
Boosts
0
Views
1.7k
Activity
Jun ’22
Example Code for WeatherKit
Could someone help me find the example code for WeatherKit that is associated with the video? Thanks.
Replies
1
Boosts
0
Views
1.6k
Activity
Jun ’22
WeatherKit geographical availability
Hi - I don't see anything in the documentation about which regions of the world the API will support e.g. US, Europe. I see there is an /api/v1/availability you can call but is there some rough guidelines around what areas are supported and which aren't. Thanks Mark.
Replies
1
Boosts
1
Views
1.1k
Activity
Jun ’22
WeatherKit OpenAPI spec
To anyone it may help, I've put together an OpenAPI spec of the WeatherKit REST API, which you may find useful for client generation using one of the OpenAPI generators. https://github.com/vanshg/WeatherKit-OpenAPI
Replies
0
Boosts
1
Views
1k
Activity
Jun ’22