Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This class is not key value coding-compliant for the key Label [duplicate]

I am using a custom UITableViewCell which already has a few UI elements on it that completely work. However, I just tried adding two labels to them and when I hook up the outlet and call cell.label.text = @"text";, the program crashes with the error:

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

I checked if there were any connections without elements on them and there were not. The app completely works when everything but new UI elements are added to the cell. It is just when I add new UI elements that the app crashes. What is the issue here?

Custom Cell Class .h

#import <UIKit/UIKit.h>

@interface FeedTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *profileImage;
@property (weak, nonatomic) IBOutlet UITextView *questionTextView;
@property (weak, nonatomic) IBOutlet UIButton *usernameButton;
@property (weak,nonatomic) IBOutlet UILabel * likesLabel;
@end

The likes label is the outlet with the issue

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object{

    FeedTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (cell == nil) {
        cell = [[FeedTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }     
    cell.likesLabel.text = @"text";
    return cell;
}

The outlet connections for the cell:

enter image description here

like image 755
s_kirkiles Avatar asked Aug 02 '14 01:08

s_kirkiles


1 Answers

After spending way too much time on this, "Cleaning the Project" fixed this same mysterious issue for me. user1851782 mentions this as his final comment, but I thought I would highlight this. Using Xcode 6.

like image 180
user3369429 Avatar answered Sep 28 '22 02:09

user3369429