我一直在使用 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 失败并完成方法停止 /abort!我该怎么做??
-(IBAction)CancleREquest:(id)sender{
NSLog(@"CancleREquest");
}