出现错误的情景:

使用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的更多相关文章

  1. 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 ...

  2. *** 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 > ...

  3. *** 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. ...

  4. 在使用可变数组过程中遇到*** 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 ...

  5. 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 ...

  6. iOS Terminating app due to uncaught exception &#39;NSInternalInconsistencyException&#39;, reason: &#39;unable to

    刚接触iOS,依照教程操作执行出现错误 Terminating app due to uncaught exception 'NSInternalInconsistencyException', re ...

  7. *** 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 ...

  8. 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( ...

  9. 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 ...

随机推荐

  1. C++explicit关键字

    在C++中,explicit关键字用来修饰类的构造函数,被修饰的构造函数的类,不能发生相应的隐式类型转换,只能以显示的方式进行类型转换. explicit使用注意事项: *     explicit  ...

  2. mongod的主要参数有

    ------------------------------------基本配置----------------------   --quiet # 安静输出 --port arg # 指定服务端口号 ...

  3. ubuntu 的远程桌面

    好久没有弄ubuntu 丢人的啊,先安装了个服务器版,发现好多命令都忘记了,命令行下根本搞不懂 又安装了个桌面版...但是服务器远程么,putty还是搞的头大,又乱码,有各种文件传输. 还好记得以前用 ...

  4. Oracle中批量插入

    为了防止OracleConnection的重复打开和关闭,使用begin end:将sql语句包在里面,然后一次性执行提高插入的效率. 下面代码中要插入的数据在list集合中,如果list集合的cou ...

  5. My97DatePicker 与 某个CSS冲突 ,导致无法显示

    调试 Metronic3.7 模版  ,boostrap的时间插件不怎么好用,改用My97DatePicker, 发现某个与plugins.css中某个插件冲突,经排查发现 css 中有这一段 ifr ...

  6. 7816的报文结构APDU

    命令APDU 包括头和主体(这可以在上面的图中看到).头包括CLA,INS,P1 和P2 域.同T0 协议一样,CLA 和INS 说明了应用的分类和指令.P1 和P2 用来详细说明具体指令,并由每一条 ...

  7. android 自定义titlebar

    首先,修改标题栏的宽度和背景,在style.xml中添加: <style> <item name="android:background">@drawabl ...

  8. intel集成显卡linux驱动安装

    https://01.org/linuxgraphics/documentation/build-guide-0 https://01.org/linuxgraphics/community/mesa ...

  9. js打开新的链接

    当前页面打开一个链接:window.location="URL" 打开一个新的页面,再打开一个新的链接:window.open(URL,窗口名称,窗口风格) window对象具有如 ...

  10. Managing Hierarchical Data in MySQL

    Managing Hierarchical Data in MySQL Introduction Most users at one time or another have dealt with h ...