I’ve a custom table view cell that I created using XIB:

I’ve also linked up the XIB file with my custom UITableView cell.
But now when I try to load the cell in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath with the following codes:
MyCustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (cell == nil) {
// Load the top-level objects from the custom cell XIB.
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomTableViewCell" owner:cell options:nil];
// Grab a pointer to the first object (presumably the custom cell, as that's all the XIB should contain).
cell = [topLevelObjects objectAtIndex:1];
}
I’ll get a [<NSObject 0x8a5b970> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key hitMeButton.
I have been searching online and one of the possible reasons might be that the XIB is not linked to the IBOutlet, I’ve checked so that doesn’t seem to be the case.
I just solved the problem, but I’m not sure if that is the most appropriate way.