This line has always been working fine for me for making Alamofire Requests and getting the JSON response.
Alamofire.request(req).responseJSON() {
(request, response, data, error) in
// ....
}
After upgrading to XCode 7 and converting the Project to Swift 2.0, all the lines of code that have my Alamofire request are not showing this error:
'(_, _, _, _) -> Void' is not convertible to 'Response<AnyObject, NSError> -> Void'
Found the answer in this link but it is in japanese. It seems this is the correct from now (taken from answer in link):
Alamofire.request(.GET, requestUrl).responseJSON {
response in
if response.result.isSuccess {
let jsonDic = response.result.value as! NSDictionary
let responseData = jsonDic["responseData"] as! NSDictionary
self.newsDataArray = responseData["results"] as! NSArray
self.table.reloadData()
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With