我在iOS上使用了很棒的ASIHTTPRequest库,我按如下方式创建了我的请求:
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://myurl/myscript.php"]];
[request addPostValue:@"myvalue" forKey:@"mykey"];
[request setRequestMethod:@"POST"];
[request setDelegate:self];
[request setDidFinishSelector:@selector(requestFinished:)];
[request setDidFailSelector:@selector(requestFailed:)];
[request setTimeOutSeconds:30];
[request setShouldAttemptPersistentConnection:YES];
[request setDidReceiveDataSelector:@selector(request:didReceiveData:)];
[request startAsynchronous];
现在您可能已经看到我正在尝试处理它的响应,实际上我不想让UITableView保持最新状态。所以我脚本的重要部分如下所示:
while(....){.....looping; echo $myvar; }
但我的iPhone拒绝等待完整的响应,请求在收到第一块数据后终止。是否有引起问题的建议以及如何解决?