Sto cercando di estrarre un oggetto JSON da iTunesAPI e analizzarlo utilizzando Swiftly JSON. Sto cercando di far uscire il nome dell'artista in console solo per verificare che funzioni, ma non riesco a ottenere un risultato per me. Qualche idea su cosa sto facendo male?
let url = NSURL(string: "http://itunes.apple.com/lookup?id=909253")
let task = NSURLSession.sharedSession().dataTaskWithURL(url!) {(data, response, error) in
let json = JSON(data)
let name = json["results"][0]["artistName"].stringValue
println ("Artist: (name)")
}
task.resume()
risposte:
1 per risposta № 1Prova questo:
let json = JSON(data:data)