简体   繁体   English

无法识别iOS Xib文件IBOutlet-(不符合键值编码的类)

[英]iOS xib file IBOutlet not recognized - (class not key-value coding compliant)

I am running XCode 7.1 and running on device(iOS 9) - (not simulator). 我正在运行XCode 7.1并在设备(iOS 9)-(不是模拟器)上运行。 I am loading up a nib file by name as such: 我正在按名称加载笔尖文件,如下所示:

MyDetailsViewController *myDetailsVC = [MyDetailsViewController initWithNibNamed:@"MyDetails" withNotificationCenter:notificationCenter];

this is simply just a class method that i have set up that loads up the xib via the mainBundle. 这只是我设置的一个类方法,它通过mainBundle加载了xib。 The xib file is just a UIView with a tableview inside of it everything seems to be hooked up properly. xib文件只是一个内部带有表视图的UIView ,似乎所有内容都已正确连接。 However, when loading the nib( viewWillAppear , viewDidLoad etc hasn't executed yet) from the bundle I get the error: 但是,当从包中加载笔尖( viewWillAppearviewDidLoad等尚未执行)时,出现错误:

NSUnknownKeyException, reason: '[MyDetailsViewController setValue:forUndefinedKey:]:This class is not key value coding-compliant for the key tableView' NSUnknownKeyException,原因:“ [MyDetailsViewController setValue:forUndefinedKey:]:此类与键tableView的键值编码不兼容”

I know that I am not getting back some generic view controller because it spells out very clearly what view controller we are talking about. 我知道我不会再找一些通用的视图控制器了,因为它可以很清楚地说明我们在说什么视图控制器。 The File Owner seems to be hooked up properly and its Custom Class is set to MyDetailsViewController . 文件所有者似乎已正确连接,其自定义类设置为MyDetailsViewController Even when I hover over the IBOutlet 'circle' in code the tableview highlights as well as when i hover over the menu when checking the outlets. 即使当我将鼠标悬停在代码中的IBOutlet“圆圈”上时,表格视图也会突出显示,并且当我在检查插座时将鼠标悬停在菜单上时。

Something that may be totally unrelated is the internal error message in the xib file, it may or may not be related to my problem and i've never seen it before. xib文件中的内部错误消息可能是完全不相关的,它可能与我的问题有关,也可能与我的问题无关,我以前从未见过。 The beginning of the log file that you get from that error is: 从该错误中获取的日志文件的开头是:

在此处输入图片说明

Can anyone help me determine what is going on here? 谁能帮我确定这是怎么回事? I would appreciate it. 我会很感激。

here are a few more screenshots: 这里还有一些截图:

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

Before init you should call alloc first: init之前,您应该先调用alloc

// MyDetailsViewController *myDetailsVC = [MyDetailsViewController initWithNibNamed:@"MyDetails" withNotificationCenter:notificationCenter];
MyDetailsViewController *myDetailsVC = [[MyDetailsViewController alloc] initWithNibNamed:@"MyDetails" withNotificationCenter:notificationCenter];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 以编程方式使用xib设置IBOutlet和文件所有者会导致键值编码兼容错误 - Using xib programatically setting IBOutlet and file owner results in key value coding-compliant error 加载 XIB 这个类不是键值编码兼容的键 - Load XIB this class is not key value coding-compliant for the key 带有 UICollectionView 的 xib - 不符合键值编码 - xib with UICollectionView - not key value coding compliant iOS-AppDelegate此类不适用于键视图的键值编码兼容 - iOS - AppDelegate this class is not key value coding-compliant for the key view iOS UITableViewCell-此类不符合键值编码的键值 - iOS UITableViewCell - this class is not key value coding-compliant for the key numberMessages iOS应用程序(此类与密钥dataSource不符合键值编码) - iOS app (this class is not key value coding-compliant for the key dataSource) 类不符合键值编码 - Class is not key value coding compliant 删除情节提要并使用Xib会生成错误“类不符合键的键值编码要求” - Deleting Storyboard and using Xib generates error “class is not key value coding-compliant for the key” 从 xib 加载 UITableViewCell(该类不符合键值编码) - Loading UITableViewCell from a xib (this class is not key value coding-compliant for the key) 将项目从情节提要更改为Xib文件时,出现“此类不符合键的键值编码”错误 - “This class is not key value coding-compliant for the key” error when changing project from storyboard to xib files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM