Fast array of messages with afnetworking
I want to post some array of numbers along with other parameters, but I am getting the error
{
error = "The operation couldn\U2019t be completed. (Cocoa error 3840.)";
}
Here is what I am trying, in my api controller I have
func postRequest(url: String, params: NSDictionary, callback:(NSDictionary) -> ()) {
manager.responseSerializer.acceptableContentTypes = NSSet(array: ["text/plain", "text/html", "application/json"]) as Set<NSObject>
manager.POST(url, parameters: params,
success: { (operation: AFHTTPRequestOperation!,responseObject: AnyObject!) in
//println("JSON: " + responseObject.description)
callback(responseObject as! NSDictionary)
},
failure: { (operation: AFHTTPRequestOperation!,error: NSError!) in
//println("Error: " + error.localizedDescription)
callback(["error" : error.localizedDescription])
})
}
Then, in my opinion, the controller, I am sending a message with
var contacts = ["xxxxxxxx", "xxxxxxxx", "xxxxxxxx"]
var params = ["id" : 1, "contacts" : contacts ]
api.postRequest(Constants.ApiUrl.Friends, params: params, callback: { (response) -> () in
//self.didReceiveResponse(response)
println(response)
})
Please how can I make this message work
+3
source to share
No one has answered this question yet
Check out similar questions: