I am trying to download some XML from the Stack Exchange API. However, I'm not getting any results back. The URL brings up the XML when accessed in the browser, but I can't seem to get that in the form of an NSData object. Or rather, I keep ending up with NSZeroData. Here is my code, note that it is written in Swift:
import UIKit
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true)
var myRequest = NSURLRequest(URL:NSURL(string: "api.stackexchange.com/answers?site=stackoverflow"))
var mySession = NSURLSession(configuration: NSURLSessionConfiguration.defaultSessionConfiguration())
var dataTask = mySession.dataTaskWithRequest(myRequest, completionHandler: { (data, response, error) in
var myData = data //myData now equals NSZeroData
})
dataTask.resume()