I am using ASIHTTPRequest to send request to web server. It all works fine. But now, when i call the grabURLInBackground
method, a request is sent to the given URL.
But now, i need to cancel the request (as in stop sending, and stop downloading the content from the URL), in the viewWillDissapear
method. How can i do this ? Help
- (IBAction)grabURLInBackground:(id)sender
{
NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request startAsynchronous];
}
- (void)requestFinished:(ASIHTTPRequest *)request
{
// Use when fetching text data
NSString *responseString = [request responseString];
// Use when fetching binary data
NSData *responseData = [request responseData];
}
- (void)requestFailed:(ASIHTTPRequest *)request
{
NSError *error = [request error];
}