Flutter webview_flutter插件加载http链

2020-06-23  本文已影响0人  zgq简书

1、Android解决方案

1、AndroidManifest.xml的application标签里面设置networkSecurityConfig

<application 

        android:networkSecurityConfig="@xml/network_security_config"> 

        <!-- ... --> 

</application>

2、在资源文件夹res/xml下面创建network_security_config.xml

<?xml version="1.0" encoding="utf-8"?> 

<network-security-config> 

        <base-config cleartextTrafficPermitted="true"> 

                <trust-anchors> 

                        <certificates src="system" />

                 </trust-anchors>

        </base-config> 

</network-security-config> 

2、IOS解决方案

在iOS 的info.plist中添加对HTTP的信任

<key>NSAppTransportSecurity</key>

<dict> 

        <key>NSAllowsArbitraryLoads</key> 

        <true/>

</dict>

上一篇下一篇

猜你喜欢

热点阅读