iosswiftasyncimageview

Image not being loaded in AsyncImageView


I've just updated to Xcode 7 and Swift 2.0, and of course it has caused some issues in my app. I have solved a lot of them, but I am struggling with this one.

In my table view, I am loading images from Parse.com, but for some reason, the images are not being displayed in the AsyncImageView. This code worked perfectly prior to updating so I'm not sure what the issue is:

    AsyncImageLoader.sharedLoader().cancelLoadingURL(cell.rideImageView.imageURL)
    cell.rideImageView.image = UIImage(named: "Unloaded")
    cell.rideImageView.imageURL = NSURL(string: ride.rideImageSmall!)

I've checked to make sure the image URL is being loaded correctly from Parse, and it is. This is the library I'm using: https://github.com/nicklockwood/AsyncImageView

Anyone have any ideas?


Solution

  • You likely encounter blocked network requests because of Apple's new "Apple Transport Security" which is active since iOS9 (= Xcode7). If you want to load data from http:// URLs you need to tell the app, that ATS shall not apply for your app or for certain domains.

    Apple's technote is here: https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/

    As a start you may add a dictionary NSAppTransportSecurity with the entry NSAllowArbitraryLoads = ON to your Info.plist and see how far you get:

    enter image description here

    If some names of the ATS settings don't work for you, read the following blog article, which describes different names - these worked for me in the past: http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/