嗨,德沃斯,
运行WWDC22 链接时出错
我从这里下载了苹果的示例项目
我就能管理这个项目了。但是,当我创建一个演示项目并添加天气获取代码时,我会出错。
我的代码:
func fetchWeather() async {
let service = WeatherService.shared
var location: CLLocation = CLLocation(latitude: 22.7196, longitude: 75.8577)
let weatherData = try? await service.weather(for: location, including: .current)
print(weatherData)
}错误:
2022-06-22 17:31:48.470130+0530 WeatherAPIDemo[25490:231389] [Database] Attempting to invalidate an assertion that is no longer valid 2022-06-22 17:31:49.208346+0530 WeatherAPIDemo[25490:231387] [WeatherService] Encountered an error when fetching weather data subset; location=<+22.71960000,+75.85770000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 6/22/22, 5:31:48 PM India Standard Time, error=invalidJWTResponse(Optional(<NSHTTPURLResponse: 0x60000308c420> { URL: https://weather-data.apple.com/v2/token } { Status Code: 401, Headers {
Connection = (
close
);
"Content-Length" = (
0
);
Date = (
"Wed, 22 Jun 2022 12:01:49 GMT"
);
Server = (
Apple
);
"Strict-Transport-Security" = (
"max-age=31536000; includeSubdomains"
);
"X-Apple-Origin" = (
"8961098f-b238-3714-ba44-5b569c861456"
);
"X-Cache" = (
"TCP_MISS from a49-44-192-207.deploy.akamaitechnologies.com (AkamaiGHost/10.8.2-41841244) (-)"
);
"X-Content-Type-Options" = (
nosniff
);
"X-Frame-Options" = (
SAMEORIGIN
);
"X-REQUEST-ID" = (
"8c733cde-5aa3-499c-b555-05c5aab5e278"
);
"X-XSS-Protection" = (
"1; mode=block"
);(}})0
发布于 2022-06-23 05:58:20
我尝试了很多,即使我已经在功能中添加了WeatherKit,但是没有起作用。
我想问题一定是我没有开发者帐户,但后来我意识到Apple Demo项目也在工作,即使没有添加任何团队(见下面img中的)。

然后,我只是复制和粘贴相同的Bundle Identifier在我的演示项目和繁荣!就像地狱一样。
发布于 2022-08-16 19:36:56
苹果开发者计划的成员资格是必需的。
来自:https://developer.apple.com/weatherkit/get-started/
需求 苹果开发者计划成员 Apple程序中包含了对WeatherKit测试版的访问,该程序还提供了开发和分发应用程序所需的所有工具、资源和支持--包括访问beta软件、应用程序服务、测试工具、应用程序分析等等。
https://stackoverflow.com/questions/72715223
复制相似问题