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

sam2themax picture sam2themax · Aug 31, 2012 · Viewed 9.7k times · Source

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

Answer

Binyamin Bauman picture Binyamin Bauman · Nov 9, 2012

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.