1

我正在通过NSURLConnection. 一切正常,期待EDGE模式。当NSLog();我连接(收到数据)时,旧图像仍在加载(逐步直到connectionDidFinishLoading),即使在[connection cancel];.

我能做些什么?在这种情况下,旧图像仍然会在新图像出现之前出现。

编辑

从 A 类调用连接:

ProductImageLoader *imageLoader = [[ProductImageLoader alloc] initWithString:productID delegate:self];

[self.queue_3LF addOperation:imageLoader];

在这里它将在 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];
    }
}

这是B类的流产:

- (void)abortRunningProcess
{
    [self.authConnection_N3I cancel];
    self.authConnection_N3I = nil;
}

从 A 类中调用:

ProductDataParser *PDP = [[ProductDataParser alloc] init];
[PDP abortRunningProcess];
4

1 回答 1

0

刚刚将连接导入另一个类。现在它完美地工作了。可能是委托错误。

于 2013-04-09T08:46:38.147 回答