After debugging for 3 hours, I avoided the error all together using the asynchronous NSMutableURLRequest, which, as I noticed, is much faster than synchronous NSData.
let requestURL: NSURL = NSURL(string: url)! let urlRequest: NSMutableURLRequest = NSMutableURLRequest(URL: requestURL) let session = NSURLSession.sharedSession() let task = session.dataTaskWithRequest(urlRequest) { (data, response, error) -> Void in if error == nil { var response = UIImage(data:data!) } else { NSLog("Fail") } } task.resume()
Nicoara talpes
source share