使用NSURL发送http出错的解决方法

about出错原因

在加载某张图的时候,采用了如下代码

let url = NSURL(string: "http://ww2.sinaimg.cn/large/6a8020f7gw1ey7895z2yuj20c808qwf5.jpg")
    sd_setImageWithURL(url, placeholderImage: nil, options: .CacheMemoryOnly, progress: {
      [weak self]
      (receivedSize, expectedSize) -> Void in
      // Update progress here
      }) {
        [weak self]
        (image, error, _, _) -> Void in
        // Reveal image here
    }

结果,Xcode报错:
Application Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app‘s Info.plist file.

最后的解决方法:

在Info.plist文件中增加App Transport Security Settings:


你可能感兴趣的:(使用NSURL发送http出错的解决方法)