【问题标题】:Open Https URL in WebView without ssl certificate在没有 ssl 证书的 WebView 中打开 Https URL
【发布时间】:2018-06-06 08:10:27
【问题描述】:
我开始学习 React Native 并尝试制作简单的应用程序。
我在 Java 上制作了服务器,在 React Native 上制作了 FE。现在我有一个问题。 React Native 中的 WebView 不会打开没有 ssl 证书的 Https URL。我做了一个自我证书,但仍然是 NSURLErrorDomain -1202
是否可以关闭此通知?我无法制作受信任的证书,因为我没有主机并且只能在 localhost 上部署我的应用程序。
screenshot
【问题讨论】:
标签:
ios
reactjs
ssl
react-native
native
【解决方案1】:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>linkedin.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
将此添加到您的 Info.plist 中,并代替linkedin.com 提供您的网址