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 ...
随机推荐
- 推荐一个PHP扩展 来真正实现PHP多线程的开发
PHP扩展下载:https://github.com/krakjoe/pthreadsPHP手册文档:http://php.net/manual/zh/book.pthreads.php <?p ...
- 关于LEA指令(单周期就可以做简单的算术计算)
堆栈种分配的局部变量所谓的“标号”,你以为是什么?(都是那些该死的宏惹的祸,大家要都是老老实实写代码,就不会有这些疑问了). 比如你用local在栈上定义了一个局部变量LocalVar,你知 ...
- POJ3009 Curling 2.0(DFS)
题目链接. 分析: 本题BFS A不了. 00100 00001 01020 00000 00010 00010 00010 00010 00030 对于这样的数据,本来应当是 5 步,但bfs却 4 ...
- BZOJ1754: [Usaco2005 qua]Bull Math
1754: [Usaco2005 qua]Bull Math Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 374 Solved: 227[Submit ...
- -_-#Error
Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters Mongo ...
- MapReduce执行过程源码分析(一)——Job任务的提交
为了能使源码的执行过程与Hadoop权威指南(2.3版)中章节Shuffle and Sort的分析相对应,Hadoop的版本为0.20.2. 一般情况下我们通过Job(org.apache.hado ...
- 向Int数组插入随机1到100
这是一个经典的面试题,考察了几个知识点 下边的代码是传统经典的做法 ]; ArrayList myList=new ArrayList(); Random rnd=new Random(); ) { ...
- 【转】VS调试技巧
[转自]http://blog.csdn.net/ghttzsqgm/article/details/5326894 http://blog.csdn.net/cadcisdhht/article/d ...
- 乱译文档--开始使用Musca
原文地址:http://aerosuidae.net/musca_start.html aerosuidae.net Musca - Start Using startx Launch it from ...
- 在Eclipse中新建Maven项目
关于Maven的好的资料: Apache官网:http://maven.apache.org/ Apache Maven 入门篇 ( 上 ):http://www.oracle.com/technet ...