我已经看到与其他许多人的这个问题,通过所有的主题,但我似乎无法找到一个解决方案。当滚动列表时,应用程序崩溃
所以我有一个普通的表格视图,一个单元格链接到一个.xib文件,首先启动一切看起来很正常,但一旦我开始滚动应用程序崩溃立即。
通过让僵尸对象我得到这个错误:
2012-05-03 16:18:13.008 coop_dev[27547:f803] * -[ActivityTableViewController tableView:cellForRowAtIndexPath:]: message sent to deallocated instance 0x6853990
但我不知道要寻找什么,或者什么可能出错:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
ItemCell *cell = (ItemCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
{
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"ItemCell" owner:nil options:nil];
cell = [topLevelObjects objectAtIndex:0];
}
Item *item = [self.activity objectAtIndex:indexPath.row];
[[cell projectLabel] setText:item.project];
[[cell descriptionLabel] setText:item.description];
[[cell timeLabel] setText:item.time];
[[cell timeAgoLabel] setText:item.timeAgo];
//cell.avatar = [UIImageView item.avatar];
cell.descriptionLabel.numberOfLines = 0;
[cell.descriptionLabel sizeToFit];
// remove the right arrow
cell.accessoryType = UITableViewCellAccessoryNone;
return cell;
}
它工作正常,在第一次发射但只是崩溃
编辑
后,我重新创建一个新的问题项目,只是一个包含一些数据的基本表格,一旦你开始滚动它崩溃。下载:http://dl.dropbox.com/u/274185/TestTable.zip
尝试确保self.activity不为零 – danielbeard
我设置了一些断点,但在它到达之前似乎崩溃了 –
我不认为您发布的代码与您的问题有关。请发布实例化ActivityTableViewController的代码。 –