SwiftyJSON来休息api - 返回nil 这是我的第一次REST Api体验
func getGif(){
let path = "http://yesno.wtf/api"
let url = NSURL(string: path)
let session = NSURLSession.sharedSession()
let task = session.dataTaskWithURL(url!){(data: NSData?, response:NSURLResponse?, error: NSError?) -> Void in
//print(">>> \(data)")
let json = JSON(data: data!)
let gif = json["answer"]["forced"]["image"].string
print("gif: \(gif)")
}
task.resume()
}