Reputation: 1074
I am using Alamofire 3.0 The following is my code
var ignoreIDs = [Int]()
self.ignoreIDs.append(2)
let parameters = ["ignore_ids": self.ignoreIDs]
Alamofire.request(.GET, AppDelegate.kbaseUrl + "surveys/me", parameters: parameters, encoding: .JSON)
.responseJSON {
response in
}
However, the result of print(response.result) just shows FAILURE. Is there any way to get more information? Also, is this the correct way to pass an array as parameters? P/S: Yes server side is indeed expecting an array.
Upvotes: 2
Views: 2128
Reputation: 1074
sorry apparently it's my own fault. My method is a GET, so as Johnny mentioned I'm parsing in a form that the server wasn't expecting.
The answer for me should be append the parameters as a query string and to my base url.
Upvotes: 0
Reputation: 16643
To print out additional information about the result, you should use debugPrint(response.result)
.
var ignoreIDs = [Int]()
self.ignoreIDs.append(2)
let parameters = ["ignore_ids": self.ignoreIDs]
Alamofire.request(.GET, AppDelegate.kbaseUrl + "surveys/me", parameters: parameters, encoding: .JSON)
.responseJSON { response in
debugPrint(response)
debugPrint(response.result)
}
Both of these are overridden to provide more detail about the actual response.
Upvotes: 2