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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With