实际上我正在尝试使用异步请求获得响应。因此我试图从字典中获取数据,但我无法这样做。我想在SWIFT中执行以下操作 NSString * s = [jsonObject valueForKey:@“EmployeeID”];
请帮帮我,谢谢。
NSURLConnection.sendAsynchronousRequest(urlRequest, queue: NSOperationQueue()) { (urlResponse, data, error) -> Void in
if let err = error {
completion("")
return
}
var err:AutoreleasingUnsafeMutablePointer<NSError?>
let jsonObject:AnyObject? = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil)as NSDictionary
var jsonResult = NSString(data: data, encoding: NSUTF8StringEncoding)
NSLog("Data : \(jsonResult)")