I start by saying that I’m not sure if what I’m doing is the best way for that.
I have the following scenario: a dynamic grouped TableView with two groups, the first has a static cell and the second has a dynamic cell populated by an array.
The second group works fine, the first is not!
The first group has only one custom cell that i load with this code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// ...
if (indexPath.section == kSectionHeader) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"ActorDetailsHeaderCell" owner:self options:nil];
ActorDetailsHeaderCell * headerCell = [topLevelObjects objectAtIndex:0];
headerCell.image.image = [UIImage imageNamed:self.actor.image];
headerCell.actorName.text = self.actor.name;
headerCell.info.text = @"";
return headerCell;
}
// ...
}
The ActorDetailsHeaderCell.xib file has a custom class named ActorDetailsHeaderCell that extends UITableViewCell class.
If I leave everything like this (just for test purpose) everything works fine, as soon as I set an IBOutletin ActorDetailsHeaderCell.h file I get this error:
'NSUnknownKeyException', reason: '[<ActorDetailsViewController 0x7485a60> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key name.'
I found on Stackoverflow those questions: iPhone: "unrecognized selector sent to instance" and error with custom UITableViewCell, but those answers don’t seem to solve my problem.
I tried to delete the .xib and the class and rewrite them from scratch but it that damn error is always there!
I end up by saying that the SAME thing is used in other UITableViewController and it works fine!
I have no idea why today everything works!
I closed the project yesterday evening and there was that error, this morning the app works!
I think is an xcode bug… I don’t know! Thanks any way