I'm using the great ASIHTTPRequest library on iOS, I created my request as follows:
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:@se开发者_StackOverflow社区lector(request:didReceiveData:)];
[request startAsynchronous];
Now as you probably see I'm trying to handle the response as it's coming in, in fact I wan't to keep a UITableView up to date. So my important part of the script looks like follows:
while(....){.....looping; echo $myvar; }
But my iPhone refuses to wait for the full response, the request terminates after first chunk of data was recieved. Any suggestions where the problem is caused and how to fix?
精彩评论