I'm trying to learn about working with APIs in Swift. As a good first test, I figured I'd hit the itunes API and just return some search results. I'm in playground using the following code. I don't get any errors, but my println isn't outputting anything. Anyone know what's wrong?
Thanks!
import UIKit
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely()
let url = NSURL(string: "https://itunes.apple.com/lookup?id=909253")
let task = NSURLSession.sharedSession().dataTaskWithURL(url!) {(data, response, error) in
println(NSString(data: data, encoding: NSUTF8StringEncoding))
}
task.resume()
Try adding this line of code:
URLCache.shared = URLCache(memoryCapacity: 0, diskCapacity: 0, diskPath: nil)