2

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?

user3746428
  • 11,047
  • 20
  • 81
  • 137
  • What does the url look like? Is it an external URL and is it http:// or https:// ? – Rainer Schwarze Sep 26 '15 at 17:57
  • Here is an example - `http://files.parsetfss.com/0f7ec53c-ea56-4a8a-9927-9ff94e1c40bd/tfss-4471a63f-f237-4542-8cfb-e343b6fa0242-Space%20Mountain_550x412.png` – user3746428 Sep 26 '15 at 18:09

1 Answers1

6

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/

Rainer Schwarze
  • 4,725
  • 1
  • 27
  • 49
  • One more quick question, I'm also parsing data from a webpage. I tried using the same technique, but it's not working for this URL - `http://dlwait.zingled.com/mk`. I am using `NSExceptionAllowsInsecureHTTPLoads` and `NSIncludesSubdomains`, both set to `YES`. `NSExceptionDomains` is `http://dlwait.zingled.com`. – user3746428 Sep 26 '15 at 22:26
  • @user3746428 You only need to set the domain without the http:, so just use `dlwait.zingled.com`. Try to use this `NSTemporaryThirdPartyExceptionAllowsInsecureHTTPLoads` (taken from the blog article) instead of the one from the technote. – Rainer Schwarze Sep 27 '15 at 07:27