美文网首页
无法获取HTTP的图片资源

无法获取HTTP的图片资源

作者: 杨帅iOS | 来源:发表于2020-01-10 14:09 被阅读0次

项目中加载微信的头像为http的开头的图片资源.
xcode报错

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

在info.plist文件中添加

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>yourdomain.com</key>
        <dict>
            <key>NSExceptionAllowInsecureHTTPLoads</key>
            <true/>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <true/>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
    <key>yourdomain.com</key> //输入图片的域名即可

相关文章

网友评论

      本文标题:无法获取HTTP的图片资源

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