ios - Getting Error Domain=kCFErrorDomainCFNetwork Code=-1000 or NSCocoaErrorDomain Code=3840 -
first of want tell duplicate question, have tried ways possible - link have searched--> bad url when requesting nsurl
ios develoment: why nsurlconnection failing "bad url" error users? bad url when requesting nsurl
i sending request server-> always getting bad url error i.e
request failed error: error domain=nsurlerrordomain code=-1000 "bad url" userinfo=0xcbf0680 {nsunderlyingerror=0xc9ad8e0 "bad url", nslocalizeddescription=bad url}, { nslocalizeddescription = "bad url"; nsunderlyingerror = "error domain=kcferrordomaincfnetwork code=-1000 \"bad url\" userinfo=0xc96dc30 {nslocalizeddescription=bad url}"; }
code->
nsstring *imgurl = [nsstring stringwithformat:@"https://graph.facebook.com/%@/picture", fbid]; nsstring *urlstring = [nsstring stringwithformat:@"%@url=register_user.json&username=%@&email=%@&dob=%@&by_socialnetwork=\"1\"&gender=%@&nicename=%@&socialimageurl=%@",base_url,[info_dict objectforkey:@"username"],[info_dict objectforkey:@"email"],[info_dict objectforkey:@"birthday"],[info_dict objectforkey:@"gender"],[info_dict objectforkey:@"name"],imgurl]; nslog(@"url %@",urlstring ); [urlstring stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; nsmutableurlrequest *request = [[nsmutableurlrequest alloc] initwithurl:[nsurl urlwithstring:urlstring] cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:5.0]; [request sethttpmethod:@"get"]; [request addvalue:@"text/json; charset=utf-8" forhttpheaderfield:@"content-type"]; //nsurlrequest *request=[[nsurlrequest alloc] initwithurl:[nsurl urlwithstring:urlstring]]; nslog(@"url %@",request ); afjsonrequestoperation *operation=[afjsonrequestoperation jsonrequestoperationwithrequest:request success:^(nsurlrequest *request, nshttpurlresponse *response, id json) { nslog(@"dgj,gfj,gf,j%@",json); [self requestsucceedwithitems:json forrequesttype:@"fb"]; }failure:^(nsurlrequest *request, nshttpurlresponse *response, nserror *error, id json) { nslog(@"request failed error: %@, %@", error, error.userinfo); [appdelegate showalert:@"error" fortext:@"network activity failed,try later."]; }]; [operation start];
terminal nslog response:-
url <nsurlrequest: 0xcd8d060> { url: http://192.168.1.100/~ha/gokk/index.php?url=register_user.json&username=abx&email=abxx@gmail.com&dob=12/19/1978&by_socialnetwork=1&gender=male&nicename=sam&socialimageurl=https://graph.facebook.com/1008823838/picture }
response:- ****sometime getting bad url error or ****
2014-02-06 13:37:01.426 flokk[1561:a0b] request failed error: error domain=nscocoaerrordomain code=3840 "the operation couldn’t completed. (cocoa error 3840.)" (json text did not start array or object , option allow fragments not set.) userinfo=0xc953c20 {nsdebugdescription=json text did not start array or object , option allow fragments not set.}, { nsdebugdescription = "json text did not start array or object , option allow fragments not set."; }
Comments
Post a Comment