Handling App Transport Security (kCFStreamErrorDomainSSL, -9802)

Handling App Transport Security (kCFStreamErrorDomainSSL, -9802)

You run this code:
let URL = “https://www.nasa.gov/sites/default/files/wave_earth_mosaic_3.jpg”
let imageData = NSData(contentsOfURL: NSURL(string: URL)!)
UIImage(data: imageData!)

and you get this:

2015-09-11 16:33:47.433 Cassini[21200:447896]
NSURLSession/NSURLConnection HTTP load failed
(kCFStreamErrorDomainSSL, -9802)… Read more