菜鸟教程小白 发表于 2022-12-11 19:39:26

ios - WebView 在 iOS 9 中不加载非标准端口


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

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

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

<p>有什么想法吗?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>当您设置 <code>Allow Arbitrary Loads = YES</code> 时,还在 <code>NSAppTransportSecurity</code> 下设置以下键:</p>

<pre><code>&lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
&lt;dict&gt;
    &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;NSAllowsArbitraryLoadsInWebContent&lt;/key&gt;
    &lt;true/&gt;
&lt;/dict&gt;
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - WebView 在 iOS 9 中不加载非标准端口,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/43928107/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/43928107/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - WebView 在 iOS 9 中不加载非标准端口