我一直在使用ASIHTTPRequest来获取数据,我想取消请求我怎么做? 我做的代码只是这样的..ASIHTTPRequest请求取消
-(void) serachData{
NSURL *url= [NSURL URLWithString:self.safestring];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setTimeOutSeconds:7200];
[request setDelegate:self];
[request startAsynchronous];
}
- (NSMutableDictionary *)requestFinished:(ASIHTTPRequest *)request
{
NSLog(@"requestFinished");
NSString *responseString = [request responseString];
SBJsonParser *json = [[SBJsonParser alloc] init];
NSMutableArray *array = [[NSMutableArray alloc] initWithObjects[jsonobjectWithString:responseString], nil];
NSLog(@"array %@",array);
}
- (void)requestFailed:(ASIHTTPRequest *)request{
NSLog(@"requestFailed");
}
//如果我按取消键(requestFinished/requestFailed方法处理时),那么ASIHTTPRequest失败,并完成方法停止/退出!我怎么做?
-(IBAction)CancleREquest:(id)sender{
NSLog(@"CancleREquest");
}
加上'为(ASIHTTPRequest *在ASIHTTPRequest.sharedQueue.operations要求)'来获取'request'变量。 – dvdfrddsgn