美文网首页
Flutter webview_flutter插件加载http链

Flutter webview_flutter插件加载http链

作者: zgq简书 | 来源:发表于2020-06-23 15:50 被阅读0次

    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>

    相关文章

      网友评论

          本文标题:Flutter webview_flutter插件加载http链

          本文链接:https://www.haomeiwen.com/subject/skshfktx.html