这听起来有点奇怪,但由于我使用了旋转滚轮指示器,因此延迟图像加载不适用于第一个图像视图(这些视图在第一个屏幕中显示)。如果用户通过延迟下载正确地向下滚动TableView中的所有其他图像。
主要问题是,NSURLConnection
未调用didReceiveData
。
- (void)startDownload
{
self.activeDownload = [NSMutableData data];
BOOL firstCell = (self.indexPathInTableView.row==0 && self.indexPathInTableView.section==0);
if(firstCell){
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString:newsContent.title_picture]] delegate:self];
NSLog(@"Get Title Pic %@ (%@)",newsContent.title, newsContent.title_picture);
self.imageConnection = conn;
}else{
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString:newsContent.cover_picture]] delegate:self];
NSLog(@"Get Thumb Pic %@ (%@)",newsContent.title, newsContent.cover_picture);
self.imageConnection = conn;
}
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
NSLog(@"[NewsPicture][connection]didReceiveData");
[self.activeDownload appendData:data];
}
修改:已添加didReceiveResponse
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
NSLog(@"[NewsPicture][connection]didReceiveResponse");
}
我将使用正确的Url获取Log“获取Thumb Pic ...(...)”,但是对于前5行(它们填充iPhone的屏幕) 4)我没有得到Log“ [NewsPicture] [connection] didReceiveData ”。
这就是我调用指标的方式:
// Spinning Wheel
HUD = [[MBProgressHUD alloc] initWithView:self.view];
HUD.tag = 1000;
[self.view addSubview:HUD];
HUD.delegate = self;
HUD.labelText = @"wird geladen";
HUD.minShowTime = 25;
HUD.dimBackground = YES;
[HUD show:true];
[HUD showWhileExecuting:@selector(doWhileLoadingNews) onTarget:self withObject:nil animated:NO];
如果我只打电话
[self doWhileLoadingNews];
在这个地方一切正常,但没有加载数据的指标。
我该怎么办呢? (如果需要,我可以发布更多代码或信息)
编辑:我仍然无法修复它。是否可以以另一种方式捕获结果然后调用'didReceiveData'?
修改:已添加didReceiveResponse
,但结果相同,didReceiveResponse
也未被调用。