OGeek|极客世界-中国程序员成长平台

标题: ios - WebView 在 iOS 9 中不加载非标准端口 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:39
标题: ios - WebView 在 iOS 9 中不加载非标准端口

我正在尝试使用 WebView 在端口 8100 上加载网站。它是 HTTPS。我无法控制更改它所服务的端口。

它可以在 iOS 10 上的模拟器和设备中正常加载。它在运行 iOS 9.3.5 的 iPad Mini 上失败 - 我看到的只是空白屏幕。

我尝试在 Info.plist 中将“App Transport Security Settings > Allow Arbitrary Loads”添加为 YES,但这并没有解决问题。

有什么想法吗?



Best Answer-推荐答案


当您设置 Allow Arbitrary Loads = YES 时,还在 NSAppTransportSecurity 下设置以下键:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
</dict>

关于ios - WebView 在 iOS 9 中不加载非标准端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43928107/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4