Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableViewCell error - this class is not key value coding-compliant for the key [duplicate]

I'm getting the following error when I try to load a custom UITableViewCell from a xib file via UINib's instantiateWithOwner method. I've tried all of the other solutions I can find on here with no luck. The issue seems to be that when the xib file is opened up by UINib, it uses the super class UITableViewCell instead of my custom class, ContentPackCell. I have attached a screenshot from Interface Builder showing where I associated the xib with my class as well associating an Identifier. There has to be some other step that I'm missing.

The error:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UITableViewCell 0x6b87220> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key descriptionLabel.'

The code (similar to Apple's sample AdvancedTableViewCells project):

ContentPackCell *cell = (ContentPackCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    [self.cellNib instantiateWithOwner:self options:nil];
    cell = tmpCell;
    self.tmpCell = nil;
}

Setting the custom class in IB

Setting an Identifier in IB


Update:

Setting the class for File's Owner

like image 960
sam2themax Avatar asked Aug 31 '12 12:08

sam2themax


1 Answers

Make sure that File's Owner in the nib is set to NSObject and also make sure that there are no outlets wired up to File's Owner.

like image 139
Binyamin Bauman Avatar answered Sep 20 '22 14:09

Binyamin Bauman