我正在尝试在 Web View 组件中显示自定义 URL(它们不是异常(exception)域中的 URL,它们是其他域,而且我并不总是知道它们的域),但似乎无法修复 Apple 的错误 1022 :无法加载资源,因为应用程序传输安全策略需要使用安全连接
我的 Info.plist
文件具有以下内容:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>akamaihd.net</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>facebook.com</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>needl-app.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
我做错了什么?
最佳答案
尝试将您的域 key 替换为:
<key>www.akamaihd.net</key>
和
<key>www.faceboook.com</key>
这似乎为我解决了这个问题。另外,对于 facebook,只要在你的 webview 中路由到 https://www.facebook.com 就可以将其删除。
关于ios - React Native Webview NSURLErrorDomain 1022,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36043683/