I am loading an image through a NSURLConnection
. Everything works fine, expect in EDGE
mode.
When I NSLog();
my connection (received data), the old image is still loading (step by step until connectionDidFinishLoading
), even after [connection cancel];
.
What can I do? In that case the old image still shows up before the new one comes in.
EDIT
The connection is called from class A:
ProductImageLoader *imageLoader = [[ProductImageLoader alloc] initWithString:productID delegate:self];
[self.queue_3LF addOperation:imageLoader];
And here it's going to be initialized in class B:
- (void)start_XL_ImageDownload
{
[self.authConnection_N3I cancel];
self.authConnection_N3I = nil;
if (self.authConnection_N3I == nil)
{
NSMutableURLRequest *request_N3I = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.softridge.ch/images/articles/%@_1_xl.jpg", self.product_id]] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:18.0];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
self.authConnection_N3I = [[NSURLConnection alloc] initWithRequest:request_N3I delegate:self];
}
}
This is the abortion in class B:
- (void)abortRunningProcess
{
[self.authConnection_N3I cancel];
self.authConnection_N3I = nil;
}
Called from within class A:
ProductDataParser *PDP = [[ProductDataParser alloc] init];
[PDP abortRunningProcess];