我正在尝试将a UILabel与IBOutlet我班级中的创建链接起来.
我的应用程序崩溃,出现以下错误.这是什么意思?我该如何解决?
***由于未捕获的异常'NSUnknownKeyException'终止应用程序,原因:'[<UIViewController 0x6e36ae0> setValue:forUndefinedKey:]:此类不是密钥XXX的密钥值编码.
当我尝试通过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)


更新:

我为我的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) 我知道这个问题在这里一次又一次地被问到,但没有找到任何解决我的问题的方法.我正在通过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)