相关疑难解决方法(0)

这是什么意思?"'NSUnknownKeyException',原因:...此类不是键值X的键值编码兼容"

我正在尝试将a UILabelIBOutlet我班级中的创建链接起来.

我的应用程序崩溃,出现以下错误.这是什么意思?我该如何解决?

***由于未捕获的异常'NSUnknownKeyException'终止应用程序,原因:'[<UIViewController 0x6e36ae0> setValue:forUndefinedKey:]:此类不是密钥XXX的密钥值编码.

macos cocoa cocoa-touch interface-builder ios

1143
推荐指数
28
解决办法
83万
查看次数

UITableViewCell错误 - 此类不是密钥值编码兼容的密钥

当我尝试通过UINib的instantiateWithOwner方法从xib文件加载自定义UITableViewCell时,我收到以下错误.我已经尝试了所有其他解决方案,我可以在这里找到没有运气.问题似乎是当Uibib打开xib文件时,它使用超类UITableViewCell而不是我的自定义类ContentPackCell.我附上了Interface Builder的截图,显示了我将xib与我的类相关联的位置以及关联标识符的位置.我必须要做一些其他的步骤.

错误:

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

代码(类似于Apple的示例AdvancedTableViewCells项目):

ContentPackCell *cell = (ContentPackCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    [self.cellNib instantiateWithOwner:self options:nil];
    cell = tmpCell;
    self.tmpCell = nil;
}
Run Code Online (Sandbox Code Playgroud)

在IB中设置自定义类

在IB中设置标识符


更新:

设置文件所有者的类

iphone cocoa-touch objective-c cocoa-bindings ios

7
推荐指数
3
解决办法
9252
查看次数

NSUnknownKeyException ios目标C.

我为我的ios应用程序创建了一个幻灯片抽屉..幻灯片抽屉工作得很好...我在幻灯片抽屉中有几个按钮和一个文本框...问题是每当我尝试添加对按钮/文本框的引用时在幻灯片抽屉里,我得到了NSUnknownKeyException ...我不知道如何解决这个问题,因为我在IO中很新...包括下面的代码......

SlideDrawer.h

#import <UIKit/UIKit.h>

@interface SlideDrawer : UIViewController
@property (strong, nonatomic) IBOutlet UIButton *home;
- (IBAction)homeclick:(id)sender;
@end
Run Code Online (Sandbox Code Playgroud)

SlideDrawer.m

#import "SlideDrawer.h"
@interface SlideDrawer ()
@end
@implementation SlideDrawer
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
 - (IBAction)homeclick:(id)sender {
}
@end
Run Code Online (Sandbox Code Playgroud)

MainViewController.h

#import <UIKit/UIKit.h>

@interface mainViewController : UIViewController{
UIView *menuDrawer;
}

@property (readonly, nonatomic) UISwipeGestureRecognizer     *recognizer_open, *recognizer_close;
@property (readonly, …
Run Code Online (Sandbox Code Playgroud)

objective-c ios nsunknownkeyexception

1
推荐指数
1
解决办法
939
查看次数

创建自定义UITableViewCell?

我知道这个问题在这里一次又一次地被问到,但没有找到任何解决我的问题的方法.我正在通过xib创建一个自定义UITableViewCell并尝试加载它.在我的VC中称为ACSummaryVC

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

    static NSString *CellIdentifier = @"SimpleTableCell";

    AcSummaryCell *cell = (AcSummaryCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"AcSummaryCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
}
Run Code Online (Sandbox Code Playgroud)

AcSummaryCell是一个子类,UITableViewCell它有一个UILabel名为acLabel 的IBOutlate.当我编译项目时,我得到以下错误 -

`Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ACSummaryVC 0x71465c0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key acLabel.'`
Run Code Online (Sandbox Code Playgroud)

我在AcSummayCell类中创建了acLabel的连接,但我从ACSummaryVC收到错误?我做错了什么?

编辑: -根据Mani的答案,我正在连接到文件所有者,这是错误的而是我要连接到自定义单元格.但是当我尝试这个我没有得到我的支出连接而不是我得到喜欢这张图片 - 在此输入图像描述

现在的问题是如何将我的支出与自定义单元格连接? 这是我的AcSummayCell.h

@interface AcSummayCell : UITableViewCell …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview ios

0
推荐指数
1
解决办法
1185
查看次数