android - 在 react-native expo android 中忽略 axios/fetch 调用中的 SSL 证书错误
问题描述
我刚开始使用 react-native 并试图用它构建一个 android 应用程序。我使用了 create-react-native-app 并使用了 expo 模板。但我无法从我的服务器 kepp 获取“网络错误”的数据。我的服务器目前没有有效的证书。有没有办法在我的 fetch 调用中忽略 ssl 证书错误?
解决方案
是的,只使用http而不是https,并在清单中设置以下行
<application
...
android:usesCleartextTraffic="true"
...>
推荐阅读
- reactjs - 从 Google Cloud Storage 提供 React 应用程序
- c++ - Cloud Files API 支持哪些 Windows 版本?
- apache-kafka - kafka 流中全局状态存储的分区数
- postgresql - 如何正确停止 postgres 统计收集器?
- mapbox-gl-js - 刷新源以更新可视化数据
- c# - C# OAuth2 SMTPclient.Authenticate() 异常
- python-3.x - 如何将 Selenium Webdriver 浏览器放入 Tkinter GUI?
- docker - Kubernetes 中 Docker 容器中的内存映射文件是否与 Linux 中的常规进程一样工作?
- amazon-web-services - Terraform 将路由附加到路由表
- c# - 连接到数据库时 SQL Express 连接错误