Weird UITableViewCell Loading Exception
debugging, iphone, uitableview
Solution
Found solution in dev forums
Create this files:
UITableViewCellContentView.h
#import <UIKit/UIKit.h>
@interface UITableViewCellContentView : UIView {
}
@end
UITableViewCellContentView.m
#include "UITableViewCellContentView.h"
@implementation UITableViewCellContentView
+ (id)alloc {
return [UIView alloc];
}
+ (id)allocWithZone:(NSZone *)zone {
return [UIView allocWithZone:zone];
}
@end
Problem
In my app, I use a custom NIB to load my UITableViewCells. The NIB's File's Owner is set so the class is my View Controller. I then Link the UITableViewCell to the IBOutlet I put in the header file. It was all working fine, until all of the sudden it stopped working, and gets this error: ``` uncaught exception 'NSInvalidUnarchiveOperationException', reason: '*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (UITableViewCellContentView)' ``` I have traced this exception to [NSBundle loadNibNamed:owner:options:] ``` static NSString *CellIdentifier = @"SubjectCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"SubjectCell" owner:self options:NULL]; cell = customSubjectCell; ``` I have tried this on two devices and the simulator, but all get the same error. I downloaded the new SDK today, and I think that may have caused this. PLEASE NOTE: This question is outdated, and the fix below was a temporary fix. Apple has fixed its SDK, so if you have the newest version of the SDK this does not apply to you.