我正在尝试使用 ASIHTTPRequest 进行异步请求,但是在请求完成时收到通知时遇到了一些问题。
-(void)doDownload{
NSURL *url = [NSURL URLWithString:@"http://www.someurl.com/?"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:@"someValue" forKey:@"someField"];
[request setRequestMethod:@"POST"];
[request setDelegate:self];
[request setDidFinishSelector:@selector(requestFinished)];
[request startAsynchronous];
}
- (void)requestFinished:(ASIHTTPRequest *)request
{
// Use when fetching text data
NSString *responseString = [request responseString];
}
requestFinished 永远不会被调用。我在 ASIHTTPRequest.m 中遇到异常,-handleStreamCompleted:
if (fileError) {
[self failWithError:fileError];
} else {
[self requestFinished]; <----- this call fails
}
有什么线索吗?