开发者

ASIHTTPFormDataRequest- "Unable to create request (bad url?)"

I have the following requirement to call a service using an ASIHTTPRequest with a POST method call. When I execute the request I get the following error:

errorError Domain=ASIHTTPRequestErrorDomain Code=5 "Unable to create request (bad url?)" UserInfo=0x790b490 {NSLocalizedDescription=Unable to create request (bad url?)}

And heres my code:

   ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:SampleURL]];
   [request addPostValue:@"emailid" forKey:username.text];
   [request addPostValue:@"password" forKey:password.text];
   [request addPostValue:@"first_name" forKey:first_name];
   [reque开发者_Python百科st addPostValue:@"last_name" forKey:last_name];
   [request addPostValue:@"option" forKey:@"userSignup"];
   request.delegate = self;
   [request startSynchronous];

Can anyone help me on this?


NSString *safestring=[strUrl stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
 NSURL *url= [NSURL URLWithString:safestring]; 


[request addPostValue:@"emailid" forKey:username.text];

Shouldn't that be in the opposite order: [request addPostValue:username.text forKey:@"emailid"];

Same for the rest...


It looks like that 'sampleURL' has some issue. What is the data type of sampleUL? it should be NSURL. Also what is in sampleURL when this piece of code is executed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜