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>
网友评论