NSUnknownKeyException setValue:forUndefinedKey:

day*_*v89 11 iphone uitableview nsexception ios5

因未捕获的异常'NSUnknownKeyException'而终止应用程序,原因:'[setValue:forUndefinedKey:]:此类不是键值按钮,符号键为buttonOfFirstView."

为什么我会收到此错误?我试图通过XIB制作一个表格单元格.添加此代码后,它会抛出上述异常.

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

    static NSString *CellIdentifier = @"MyCell";

    MyTableViewCell *cell = (MyTableViewCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        NSArray *arrayCellXib = [[NSBundle mainBundle] loadNibNamed:@"MyTableViewCell" 
                                                              owner:self 
                                                            options:nil];

....
} 
.....

return cell;
}
Run Code Online (Sandbox Code Playgroud)

怎么解决?

小智 47

检查你的XIB中你的出口的引用,其中一个可能引用了一个不再存在的属性(buttonOfFirstView)