, [whateverConnection cancel] viewDidUnload dealloc. . , , , , NSURLConnection. ( ) dealloc . bool, wasCanceled, - , wasCanceled . ( , , , , - ). , . , , , .
@interface CompaniesDownloader : NSObject /*<NSXMLParserDelegate>*/
{
id<CompaniesDownloaderDelegate> delegate;
NSMutableArray *companies;
BOOL isWorking;
BOOL wasCanceled;
@private
NSURLConnection *companiesConnection;
NSMutableData *webData;
NSMutableString *tmpString;
Company *tmpCompany;
}
:
-(void) cancel
{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible: FALSE];
wasCanceled = TRUE;
[companiesConnection cancel];
[webData release];
webData = nil;
self.companiesConnection = nil;
isWorking = FALSE;
}