我正在使用Uber APINSURLSession
获取 JSON 数据。我有一个服务器令牌和一个客户端 ID 和一个. 如何更新以下代码以验证和传递参数(服务器令牌、纬度和经度)?Secret
let urlPath = "https://api.uber.com/v1/products"
let url = NSURL(string: urlPath)
let session = NSURLSession.sharedSession()
let task = session.dataTaskWithURL(url, completionHandler: {data, response, error -> Void in
if (error != nil) {
println(error)
}
else {
let jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as NSDictionary
println(jsonResult)
}
})
task.resume()