Terminating app due to uncaught exception 'NSUnknownKeyException', reason: xxxx
出现错误的情景:
使用Swift自定义Cell, 然后将这个Cell在OC中使用, 由于为了能够在OC中使用和使用起来命名比较规范
我在Swift自定义的Cell前加了 @objc(DSProductCell)
完整版是这样的:
@objc(DSProductCell) class ProductCell: UITableViewCell {}
然后在xib上对cell进行搭建...
之后在OC使用的时候就出现了这个错误...
最后排查出现这个问题的原因:
xib中的class没有加上前缀, 也就是默认是ProductCell, 需要改为:DSProductCell
之后编译还是不行, clean了一下, 在进行编译, 就可以了...
所以在这里使用的时候需要注意一下..
另外还有一个需要注意的地方, 就是tableView在registerNib的时候, nibName是xib文件的名字,
注意, 是xib的文件名, 例如ProductCell.xib, register的时候就是:
[self.tableView registerNib:[UINib nibWithNibName:@"ProductCell" bundle:nil] forCellReuseIdentifier:reuseIdentifier];
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: xxxx的更多相关文章
- Terminating app due to uncaught exception 'NSUnknownKeyException' this class is not key value coding-compliant for the key
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ViewController > se ...
- *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ViewController > setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ViewController > ...
- *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<WKWebViewConfiguration 0x1701bcd20> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the k
问题描述: ionic项目,windows下正常,打包android可正常运行: 因为需要打包到iPhone (ios 11.0.1)上测试,将代码拿到Mac OS环境下(重新npm install. ...
- 在使用可变数组过程中遇到*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object'问题
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFD ...
- Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
报错: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlace ...
- iOS Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to
刚接触iOS,依照教程操作执行出现错误 Terminating app due to uncaught exception 'NSInternalInconsistencyException', re ...
- *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[<_UIFeedbackParameters 0x1d4442e50> setNilValueForKey]: could not set nil as the value for the key rate.'
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[<_UIFeedbac ...
- Terminating app due to uncaught exception 'CALayerInvalid', reason: 'layer <CALayer: 0x7fda42c66e30> is a part of cycle in its layer tree'
iOS App里面所有的View构成一个组件树,这个树里面如果有了闭环就会出现这个报错,最常见的你不小在某UIViewController里面写了这样的代码: someView.addSubView( ...
- Adding an Exception Breakpoint - Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 25 bey
用如下的方法可以非常方便停留到具体crash的某行代码 Adding an Exception Breakpoint Add an exception breakpoint to your proje ...
随机推荐
- ZOJ1074 (最大和子矩阵 DP)
F - 最大子矩阵和 Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Descri ...
- 魅蓝3s adb interface 找不到驱动程序
完全照搬大神的步骤就ok啦,,自己记录下,方便以后查找 Win7 x64 Eclipse无法识别手机 / adb interface有黄色感叹号,无法识别 http://blog.csdn.net/z ...
- 尝试跑一跑Scut
前段时间都在用 IIS+WCF+Redis+MSSQL 的框架做服务器,前段时间看到了 Scut 的开源框架,整个架构还是蛮干净整洁的... 今天抓来跑一跑. 按照教程安装好所有的环境,版本是6.7. ...
- 测试和恢复性的争论:面向对象vs.函数式编程
Michael Feathers最近的博文在博客社区引发了一场异常激烈的论战.Feathers发表言论说一些面向对象编程语言的内嵌特性有助于测试的进行,并且使用面向对象编程语言编写的代码更容易恢复. ...
- ISO7816协商模式和特定模式
ISO7816协议的协商模式和特定模式好多使用者都搞不明白,还经常有客户电话询问,这里将其澄清一下: ISO7816协议的协商模式和特定模式由复位应答字节TA2确定,下面是TA2的字节定义 TA2的存 ...
- 感兴趣的Linux发行版
1. Ubuntu,包括KUbuntu,XUbuntu,Kyrin等等 2. BluestarLinux - 基于Arch Linux,感觉很美 http://sourceforge.net/proj ...
- POJ1088 滑雪(记忆化搜索)
题目链接. 分析: 状态转移方程 d[i][j] = max(d[i-1][j], d[i+1][j], d[i][j-1], d[i][j+1]). #include <iostream> ...
- COJ 0343 WZJ的公司(二)
传送门:http://oj.cnuschool.org.cn/oj/home/problem.htm?problemID=313 试题描述: WZJ的公司放假了!为了保证假期期间公司的安全,WZJ决定 ...
- jstat(JVM Statistics Monitoring Tool)
功能 用于监视虚拟机各种运行状态信息的命令行工具.它可以显示本地或远程虚拟机进程中的类装载.内存.垃圾收集.JIT编译等运行数据,在没有GUI图形界面,只提供了纯文本控制台环境的服务器上,它将是运 ...
- libvirt API管理hypervisors
发布一段C代码,用于连接指定的KVM宿主机器,获得该宿主机器的配置信息,以及该主机上所有的虚拟主机列表.状态及配置信息: #include <stdio.h>#include <st ...