Alamofire with custom parameter encoding for swift application -
i have phone call methods soap web service in swift application, think should utilize custom parameter encoding, when create closure encoding seems never called. doing wrong?
here code:
allow custom: (urlrequestconvertible, [string: anyobject]?) -> (nsurlrequest, nserror?) = { (urlrequest, parameters) in allow mutableurlrequest = urlrequest.urlrequest.mutablecopy() nsmutableurlrequest mutableurlrequest.setvalue("text/xml; charset=utf-8", forhttpheaderfield: "content-type") mutableurlrequest.httpbody = body homecoming (mutableurlrequest, nil) } alamofire.request(.post, webserviceurlstring, parameters: nil, encoding: .custom(custom)).responsestring { (request, response, data, error) -> void in println(data) }
the custom
closure not executed design, because there no parameters encode. he're code excerpt taken alamofire.swift source file:
if parameters == nil { homecoming (urlrequest.urlrequest, nil) }
as can see, can bybass status passing empty dictionary:
alamofire.request(.post, webserviceurlstring, parameters: dictionary(), encoding: .custom(custom))
the custom
closure executed.
swift alamofire
No comments:
Post a Comment