由于未捕获的异常'NSUnknownKeyException'终止应用程序,原因:'[setValue:forUndefinedKey:]:此类不是密钥值编码兼容的密钥 buttonOfFirstView。'
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key buttonOfFirstView.'
为什么会出现此错误?我试图通过XIB制作一个表格单元格。添加此代码后,它抛出上述异常。
Why do I get this error? I am trying to make a table cell though XIB. After I add this code it throws the above exception.
- (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; }如何解决?
推荐答案检查您的XIB中的商店的引用,其中一个可能引用了不再存在的属性(buttonOfFirstView)
Check your references of your outlets in your XIB, one of them is probably referencing a property (buttonOfFirstView) that does not exist anymore
更多推荐
NSUnknownKeyException setValue:forUndefinedKey:
发布评论