swift - Recieve data from database with ID and without JSON -
i trying data database without json. when tried code, error. ideas? doing week , not know. head hairless.
let request = nsmutableurlrequest(url: nsurl(string: "http://servis.dronysitmp.cz/cteni_baterie.php")! url) request.httpmethod = "get" let getstring = "a=\(oznaceni)" request.httpbody = getstring.data(using: string.encoding.utf8) let task = urlsession.shared.datatask(with: request urlrequest) { data, response, error in if error != nil { print("error=\(string(describing: error))") return } print("response = \(string(describing: response))") let responsestring = nsstring(data: data!, encoding: string.encoding.utf8.rawvalue) print("responsestring = \(string(describing: responsestring))") } task.resume() } 2017-09-11 10:50:31.406216+0200 cteni_pod_indexem[434:489371] [] nw_endpoint_flow_service_writes [6.1 87.236.196.140:80 ready socket-flow (satisfied)] write request has 4294967295 frame count, 0 byte count
2017-09-11 10:50:41.488729+0200 cteni_pod_indexem[434:489371] [] nw_endpoint_handler_add_write_request [4.1 87.236.196.140:80 failed socket-flow (satisfied)] cannot accept write requests
2017-09-11 10:50:41.492515+0200 cteni_pod_indexem[434:489383] [] tcp_connection_write_eof_block_invoke write close callback received error: [22] invalid argument error=optional(error domain=nsurlerrordomain code=-1001 "the request timed out." userinfo={nsunderlyingerror=0x17005a5b0 {error domain=kcferrordomaincfnetwork code=-1001 "(null)" userinfo={_kcfstreamerrorcodekey=-2102, _kcfstreamerrordomainkey=4}}, nserrorfailingurlstringkey=http://servis.dronysitmp.cz/cteni_baterie.php, nserrorfailingurlkey=http://servis.dronysitmp.cz/cteni_baterie.php, _kcfstreamerrordomainkey=4, _kcfstreamerrorcodekey=-2102, nslocalizeddescription=the request timed out.}
i have solve this, changed httpmethod "post"
Comments
Post a Comment