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}

PlayWithWeatherKit/ContentView.swift:28: Fatal 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}},,

Adding an iPad target, and running the code is an iPad simulator worked perfectly.

Well, it is slight comfort to know that it works well on iPad. I had the same problem, too. I was not content to just play with weather kit—I made a menubar app—moving to iPad wouldn't work so well for that. I could change some code and move stuff around, but, no, I want it to work on macOS.

I feel slightly better in knowing that it isn't just me—misery loves company? However, I kept reading and noticed I was getting errors about the sandbox and networking.

Your log shows them too:

PlayWithWeatherKit[16282:277991] [] nw_resolver_can_use_dns_xpc_block_invoke Sandbox does not allow access to com.apple.dnssd.service

TL;DR

I am now getting data. Yippee!

I added both incoming and outgoing network options to the App Sandbox in Signing & Capabilities. The number of errors is reduced significantly and seems to be limited to the weather directory and bundle ID.

WeatherKit - getting many errors including "The file “Weather” couldn’t be opened because you don’t have permission to view it."
 
 
Q