iPhone和ASIHTTPRequest - 无法启动HTTP连接

los*_*sit 5 iphone asihttprequest

我正在使用ASIHTTPRequest类来与Web服务进行通信并获得响应.这是我向服务器发送请求的方式

NSString *str = [NSString stringWithFormat:@"%@verifyLogin.json", serverUrl];
NSURL *url = [NSURL URLWithString:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
[request addRequestHeader:@"Content-Type" value:@"text/x-gwt-rpc; charset=utf-8"];
NSDictionary* data = [NSDictionary dictionaryWithObjectsAndKeys:emailId, @"username", pwd, @"password", nil];
[request appendPostData: [[data JSONFragment] dataUsingEncoding: NSUTF8StringEncoding]];
[request setRequestMethod:@"POST"];
[request setDelegate:self];
[request setDidFinishSelector: @selector(gotLoginResponse:)];
[request setDidFailSelector: @selector(loginRequestFailed:)];

[networkQueue addOperation: request];
[networkQueue go];
Run Code Online (Sandbox Code Playgroud)

控件立即进入错误例程,错误描述和域名

无法启动HTTP连接ASIHTTPRequestErrorDomain

我可以通过桌面工具获取相同的请求来检查HTTP请求,因此我知道设置都是正确的.

有人可以在发送请求时告诉我我在这里失踪了吗?

谢谢.

Jak*_*ake 5

正如我之前评论的那样;

在你的第一行,它说"%verifyLogin.json".不应该那样; "%@ verifyLogin.json"????