ios - The network connection was lost when calling PHP API -
var submitdic = nsmutabledictionary () submitdic.setobject (loginmerged, forkey: "module" ) submitdic.setobject (kedahe-tutorapp, forkey: "wskey" ) submitdic.setobject (112211, forkey: "passwd" ) submitdic.setobject (form04, forkey: "username" ) var request : nsmutableurlrequest = nsmutableurlrequest() request.url = nsurl(string: http://kedah-etutor.com/component/module/ws_function2.php) request.httpmethod = "post" request.httpbody = nsjsonserialization.datawithjsonobject(submitdic, options: nsjsonwritingoptions() , error: nil) println(nsjsonserialization.datawithjsonobject(submitdic, options: nsjsonwritingoptions() , error: nil)?.description) request.setvalue("application/json; charset=utf-8", forhttpheaderfield: "content-type") nsurlconnection.sendasynchronousrequest(request, queue: nsoperationqueue.mainqueue(), completionhandler:{ (response:nsurlresponse!, data: nsdata!, error: nserror!) -> void in var error : autoreleasingunsafemutablepointer<nserror?> = nil if data != nil { }
i have tried call php json web service, returns null data , error description keep mention "the network connection lost". besides, in java httpclient framework works php web services.
Comments
Post a Comment