出现错误的情景:

使用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. Java System类

    java 不支持 全局方法 和 变量, system 类 中所有成员都是静态的, 而要引用这些变量和方法,可直接system作为前缀,

  2. 关于cmd的东西

    为了督促自己,就从简单的开始学起,希望用博客来纪念我的成长 1)输入 CMD 回车.进入DOS提示符状态下.输入cd\ 回车 表示进入 c:\> 也到了C盘根目录下 2)d: 回车 是进入D盘当 ...

  3. 破解简单Mifare射频卡密钥杂记

    先要了解一点大学城浴卡用的是什么卡,经查证是Mifare S50卡,也有叫ISO14443A的(协议名).本来想看看大学城浴卡有没有安全漏洞,没想到浴卡公司在安全性上几乎是蔑视我们大学生的智商,虽然被 ...

  4. 7.4.1 Dumping Data in SQL Format with mysqldump

    7.4 Using mysqldump for Backups 使用mysqldump 用于备份: 7.4.1 Dumping Data in SQL Format with mysqldump 7. ...

  5. 【转】Ubuntu Server 12.04 静态IP简洁配置

    原文网址:http://blog.csdn.net/njchenyi/article/details/8715417 1.配置静态IP地址: # vim /etc/network/interfaces ...

  6. bzoj3573[Hnoi2014]米特运输

    http://www.lydsy.com/JudgeOnline/problem.php?id=3573 好吧,虽然这是day1最后一题,但却是最水的一题....(前提:看懂题目) 仔细看题! 仔细看 ...

  7. 后缀.aspx.cs是什么软件的生成的

    ASP.NET技术 aspx ——ASP.NET文件(网页) aspx.cs ——ASP.NET文件中的代码页(与上面的对应) asp.net是微软公司推出的新一代网站程序开发架构,ASP.NET技术 ...

  8. lr11 录制脚本时候,无法自动启动ie,查了网上很多方法都未解决?

    解决办法是把杀毒软件.防火墙都关闭,再重新运行一次,就可以了

  9. 一个强大的LogParser的UI工具--logparserlizard简介(开源IIS日志分析工具)

    原文地址:http://blog.csdn.net/downmoon/article/details/4509513 日志分析,特别是IIS日志,一般人都会想到LogParser工具,的确很强.但是命 ...

  10. KVM几种缓存模式

    原文在这里: http://pic.dhe.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=%2Fliaat%2Fliaatbpkvmguestca ...