iOS 开发错误集锦

2017-11-18  本文已影响51人  爬树的蚂蚁
1.tableView中 重用xib创建的cell时报错(17-11-18)
错误

terminating with uncaught exception of type NSException

情景
[self.tableView registerNib:[UINib nibWithNibName:@"MCZHTableViewCell" bundle:nil] forCellReuseIdentifier:@"MCZHTableViewCell"];
MCZHTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"MCZHTableViewCell" forIndexPath:indexPath];

一运行,就会在重用这里崩溃,崩溃原因就是:terminating with uncaught exception of type NSException
而且我在新的工程里面没事,就是在一个老项目中出现这个问题。

原因及解决

最后面发现这个项目是MRC和ARC混编的,所以在下图中的目录添加cell的xib文件即可解决


QQ20171118-110344@2x.png
上一篇 下一篇

猜你喜欢

热点阅读