每当我尝试访问 WeatherKit 时,我总是收到此消息
2022-11-03 21:02:37.690374-0500 Weather[151:578] [AuthService] Failed to get remote object proxy for: com.apple.weatherkit.authservice with error: Error Domain=NSCocoaErrorDomain Code=407 "connection to service named com.apple.weatherkit.authservice" UserInfo={NSDebugDescription=connection to service named com.apple.weatherkit.authservice} 2022-11-03 21:02:37.6914-000 Weather[151:580] [WeatherService] Encountered an error when fetching weather data subset; location=<+37.785800,-122.441700> +/- 5.00m (speed -1.00 mps / course -1.00) @ 11/3/22, 9:02:25 PM Central Daylight Time, error=xpcConnectionFailed(Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.weatherkit.authservice" UserInfo={NSDebugDescription=connection to service named com.apple.weatherkit.authservice}) erorr 2022-11-03 21:02:37.691307-0500 Weather[15211:580478] [WeatherService] Encountered an error when fetching weather data subset; location=<+37.7800,-122.401700> +/- 5.00m (speed -1.00 mps / course -1.00) @ 11/3/22, 9:02:25 PM Central Daylight Time, error=xpcConnectionFailed(Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.weatherkit.authservice" UserInfo={NSDebugDescription=connection to service named com.apple.weatherkit.authservice}) erorr 2022-11-03 21:02:38.15636-0500 Weather[1511:5478] [AuthService] Failed to get remote object proxy for: com.apple.weatherkit.authservice with error: Error Domain=NSCocoaErrorDomain Code=409 "connection to service named com.apple.weatherkit.authservice" UserInfo={NSDebugDescription=connection to service named com.apple.weatherkit.authservice} 2022-11-03 21:02:38.1562-0500 Weather[15211:588] [WeatherService] Encountered an error when fetching weather data subset; location=<+37.783400,-122.4000> +/- 5.00m (speed -1.00 mps / course -1.00) @ 11/3/22, 9:02:38 PM Central Daylight Time, error=xpcConnectionFailed(Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.weatherkit.authservice" UserInfo={NSDebugDescription=connection to service named com.apple.weatherkit.authservice})
代码:
Task {
do {
let result = try await service.weather(for: location)
print(result)
}
catch {
print("error")
}
}
这与 Auth 有关吗?我还在我的应用程序包中启用了 WeatherKit,但仍然收到此响应。
最佳答案
确保将 WeatherKit 添加为目标的“签名和功能”中的一项功能。
关于ios - 无法访问 WeatherKit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74311436/