首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WeatherKit iOS SDK 401网络错误⛈2022

WeatherKit iOS SDK 401网络错误⛈2022
EN

Stack Overflow用户
提问于 2022-06-22 12:08:45
回答 2查看 343关注 0票数 1

嗨,德沃斯‍‍,

运行WWDC22 链接时出错

我从这里下载了苹果的示例项目

我就能管理这个项目了。但是,当我创建一个演示项目并添加天气获取代码时,我会出错。

我的代码:

代码语言:javascript
复制
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)
    }

错误:

代码语言:javascript
复制
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

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-06-23 05:58:20

我尝试了很多,即使我已经在功能中添加了WeatherKit,但是没有起作用。

我想问题一定是我没有开发者帐户,但后来我意识到Apple Demo项目也在工作,即使没有添加任何团队(见下面img中的)。

然后,我只是复制和粘贴相同的Bundle Identifier在我的演示项目和繁荣!就像地狱一样。

票数 -1
EN

Stack Overflow用户

发布于 2022-08-16 19:36:56

苹果开发者计划的成员资格是必需的

来自:https://developer.apple.com/weatherkit/get-started/

需求 苹果开发者计划成员 Apple程序中包含了对WeatherKit测试版的访问,该程序还提供了开发和分发应用程序所需的所有工具、资源和支持--包括访问beta软件、应用程序服务、测试工具、应用程序分析等等。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72715223

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档