I have the following code :
let urlPath:String = apiURL + apiVersion + url + \"?api_key=\" + apiKey
let url = NSURL(string: urlPath)
let session = NSURLSessi
The task never completes because it never gets started. You have to manually start the data task using its resume() method.
let urlPath = apiURL + apiVersion + url + "?api_key=" + apiKey
let url = NSURL(string: urlPath)!
let session = NSURLSession.sharedSession()
let task = session.dataTaskWithURL(url) { data, response, error in
print("Task completed")
// rest of the function...
}
task.resume()