gpt4 book ai didi

ios - 由于 App 传输安全性,Parse-Server 未下载 PFFile

转载 作者:可可西里 更新时间:2023-11-01 05:43:21 24 4
gpt4 key购买 nike

我正在从 Parse 的后端迁移到 Heroku 和 MongoDB 上的 Parse-server。

有了这个新的后端更改,我的一切工作都很顺利(包括加载 PFFiles),但是,我现在在添加 FACEBOOK_APP_ID 参数后遇到错误,但是,这可能不是原因。

每当我尝试加载 PFFile(图片)时,我都会在日志中收到以下消息:

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
2016-02-20 19:55:48.242 HoopMaps[35976:682425] [Error]: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. (Code: 100, Version: 1.12.0)
2016-02-20 19:55:48.243 HoopMaps[35976:682425] [Error]: Network connection failed. Making attempt 1 after sleeping for 1.730434 seconds.
2016-02-20 19:55:50.137 HoopMaps[35976:682402] [Error]: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. (Code: 100, Version: 1.12.0)
2016-02-20 19:55:50.138 HoopMaps[35976:682402] [Error]: Network connection failed. Making attempt 2 after sleeping for 3.460868 seconds.
2016-02-20 19:55:53.857 HoopMaps[35976:682403] [Error]: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. (Code: 100, Version: 1.12.0)
2016-02-20 19:55:53.857 HoopMaps[35976:682403] [Error]: Network connection failed. Making attempt 3 after sleeping for 6.921736 seconds.
2016-02-20 19:56:01.162 HoopMaps[35976:682821] [Error]: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. (Code: 100, Version: 1.12.0)
2016-02-20 19:56:01.162 HoopMaps[35976:682821] [Error]: Network connection failed. Making attempt 4 after sleeping for 13.843473 seconds.
2016-02-20 19:56:15.264 HoopMaps[35976:682785] [Error]: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. (Code: 100, Version: 1.12.0)

虽然我可以禁用 ATS,但这是一种不好的做法,我更愿意使用 HTTPS。此外,错误代码为“100”,但我可以连接到我的服务器并检索对象和用户数据。

如何在保留 HTTPS 的同时使用 Parse-server 加载 PFFiles?

最佳答案

最好的办法是为您的 API 获取 SSL 证书,但如果这不可能,暂时的解决方法是将您的域添加为 ATS 的异常(exception)。

这样,您就不需要完全禁止 ATS(正如您所指出的,这是一种不好的做法),但您的应用仍将允许来自您的域的不安全调用。

为此,请打开您的 Info.plist 文件并添加 App Transport Security Settings。然后选择 Exception Domains 并将您的域添加到列表中。

App Transport Security Settings

Exception Domains

这就是您的 Info.plist 在结尾处的样子:

Your domain

关于ios - 由于 App 传输安全性,Parse-Server 未下载 PFFile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35532231/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com