我正在使用 SDWebImage 库将图像加载到 uitableview。请参阅下面的加载代码。但是当我从设备运行时,它偶尔会崩溃,指出“由于未捕获的异常而终止应用程序' NSInternalInconsistencyException '”
NSString *gTableIdentifier = @"GTableCell";
GTableCell *cell = (GTableCell *)[tableView dequeueReusableCellWithIdentifier:gTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"GTableCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
//Selection Color
UIView *selectionView = [[UIView alloc]initWithFrame:cell.bounds];
[selectionView setBackgroundColor:TABLE_SELECTION_COLOR];
cell.selectedBackgroundView = selectionView;
[cell.thumbnailImageView.layer setBorderColor:[[UIColor grayColor] CGColor]];
[cell.thumbnailImageView.layer setBorderWidth:1.0];
}
cell.headline.text = [ShContentManager GetHeadLinesTitle:[indexPath row]];
cell.headLineSource.text = [ShContentManager GetHeadLinesTitleSource:[indexPath row]];
NSString *imageURL = [ShContentManager GetHeadLinesImageURL:[indexPath row]];
if(imageURL != NULL)
{
[cell.thumbnailImageView setImageWithURL:[NSURL URLWithString:imageURL]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
}
else
{
[cell.thumbnailImageView.layer setBorderColor:[[UIColor grayColor] CGColor]];
[cell.thumbnailImageView.layer setBorderWidth:1.0];
cell.thumbnailImageView.image = [UIImage imageNamed:@"apple-touch-icon-iphone.png"];
}
以下是错误详情
2013-05-07 20:46:35.732 TopStory[35529:907] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '{ Rows:
GTableCell:0x1cdca0d0.Height == 180 + 1*0x1d8b4830.marker
GTableCell:0x1cdca0d0.Width == 640 + 1*0x1d8b46a0.marker
GTableCell:0x1cdca0d0.minX == 0 + 1*0x1d8b3810.marker + -0.5*0x1d8b46a0.marker
GTableCell:0x1cdca0d0.minY == 360 + 1*0x1d8b44b0.marker + -0.5*0x1d8b4830.marker
UILabel:0x1cdca210.minX == 166 + -1*0x1cdca680.marker + 1*0x1cdca6c0.marker + -1*0x1cdca700.marker + 1*UIImageView:0x1d896ee0.minX
UILabel:0x1cdca210.minY == 0 + -1*0x1cdca640.marker + 1*UIImageView:0x1d896ee0.Height + 1*UIImageView:0x1d896ee0.minY + -1*UILabel:0x1cdca210.Height
UILabel:0x1d896e50.minX == 166 + -1*0x1cdca680.marker + 1*0x1cdca6c0.marker + -1*0x1cdca700.marker + 1*0x1cdca740.marker + 1*UIImageView:0x1d896ee0.minX + 1*UILabel:0x1cdca210.Width + -1*UILabel:0x1d896e50.Width
UILabel:0x1d896e50.minY == -0 + -1*0x1cdca5c0.marker + 1*0x1cdca780.marker + 1*UIImageView:0x1d896ee0.minY
UILabel:0x1d8d56b0.minX == 166 + -1*0x1cdca680.marker + 1*0x1cdca6c0.marker + 1*UIImageView:0x1d896ee0.minX
UILabel:0x1d8d56b0.minY == 0 + -1*0x1cdca5c0.marker + 1*UIImageView:0x1d896ee0.minY
UITableViewCellContentView:0x1cdc9af0.minX == 12 + 1*0x1cdca680.marker + -1*UIImageView:0x1d896ee0.minX
UITableViewCellContentView:0x1cdc9af0.minY == 90 + 1*0x1cdca600.marker + 0.5*0x1d8b4830.marker + -0.5*UIImageView:0x1d896ee0.Height + -1*UIImageView:0x1d896ee0.minY
objective == <> + <750:-1>*0x1d8b0b60.negError + <250:-1>*0x1d8b0b60.posErrorMarker + <750:-1>*0x1d8b0c30.negError + <250:-1>*0x1d8b0c30.posErrorMarker
约束:
<NSAutoresizingMaskLayoutConstraint:0x1d8b3810 h=--- v=--- GTableCell:0x1cdca0d0.midX == + 320> Marker:0x1d8b3810.marker
<NSAutoresizingMaskLayoutConstraint:0x1d8b44b0 h=--- v=--- GTableCell:0x1cdca0d0.midY == + 450> Marker:0x1d8b44b0.marker
<NSContentSizeLayoutConstraint:0x1d8b0b60 H:[UIImageView:0x1d896ee0(80)] Hug:250 CompressionResistance:750> Marker:0x1d8b0b60.posErrorMarker
<NSContentSizeLayoutConstraint:0x1d8b0c30 V:[UIImageView:0x1d896ee0(60)] Hug:250 CompressionResistance:750> Marker:0x1d8b0c30.posErrorMarker
<NSLayoutConstraint:0x1cdca5c0 UIImageView:0x1d896ee0.top == UILabel:0x1d8d56b0.top> Marker:0x1cdca5c0.marker
<NSLayoutConstraint:0x1cdca600 UIImageView:0x1d896ee0.centerY == GTableCell:0x1cdca0d0.centerY> Marker:0x1cdca600.marker
<NSLayoutConstraint:0x1cdca640 UIImageView:0x1d896ee0.bottom == UILabel:0x1cdca210.bottom> Marker:0x1cdca640.marker
<NSLayoutConstraint:0x1cdca680 UIImageView:0x1d896ee0.leading == GTableCell:0x1cdca0d0.leading + 6> Marker:0x1cdca680.marker
<NSLayoutConstraint:0x1cdca6c0 UILabel:0x1d8d56b0.leading == GTableCell:0x1cdca0d0.leading + 89> Marker:0x1cdca6c0.marker
<NSLayoutConstraint:0x1cdca700 UILabel:0x1d8d56b0.leading == UILabel:0x1cdca210.leading> Marker:0x1cdca700.marker
<NSLayoutConstraint:0x1cdca740 UILabel:0x1d896e50.trailing == UILabel:0x1cdca210.trailing> Marker:0x1cdca740.marker
<NSLayoutConstraint:0x1cdca780 UILabel:0x1d896e50.top == UILabel:0x1d8d56b0.top> Marker:0x1cdca780.marker
<NSLayoutConstraint:0x1d8b46a0 H:[GTableCell:0x1cdca0d0(640)]> Marker:0x1d8b46a0.marker
<NSLayoutConstraint:0x1d8b4830 V:[GTableCell:0x1cdca0d0(180)]> Marker:0x1d8b4830.marker
}: internal error. Cannot find an outgoing row head for incoming head 0x1d8b0b60.negError, which should never happen.'
*** First throw call stack:
(0x324ea2a3 0x3a21297f 0x324ea1c5 0x32e9c11f 0x32e9e759 0x32e9e8af 0x3472bc4f 0x34308451 0x34306f39 0x11352d 0x10f7f9 0x10aa91 0x3a62a11f 0x3a6294b7 0x3a62e1bd 0x324bdf3b 0x32430ebd 0x32430d49 0x360092eb 0x34346301 0xd74bd 0x3a649b20)
libc++abi.dylib: terminate called throwing an exception