ios - Json response is successful in browser but displays error message in simulator -


i have server sends json web response using browser. when same url passed through simulator throws error message. code below:

nsstring *poststring = [nsstring stringwithformat:@"username=\"tango\"&password=\"charlie\""];  nslog(@"%@",poststring); //encode post string in supported encoding format in post data postdata = [poststring datausingencoding:nsasciistringencoding allowlossyconversion:yes];  if(connection)   return yes; else    return no;  [nsmutablerequest sethttprequest:urlstring]; 

the header part follows:

[request seturl:url];  //set http method post [request sethttpmethod:@"post"];  //set http header field length of post data [request setvalue:postlength forhttpheaderfield:@"content-length"];  //set encoding value http header field [request setvalue:@"application/x-www-form-urlencoded" forhttpheaderfield:@"content-type"];   //set http body or url request postdata  [request sethttpbody:postdata]; 

i expected successful log message simulator shows invalid username , password log.

what reason?


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -