UITableViewCell抛出异常 [英] UITableViewCell throwing exception

查看:239
本文介绍了UITableViewCell抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将项目更新到iOS 8,并且正在使用我的一个UITableViewCell实现来解决这个问题。目前在模拟器上而不是设备,它被设置为iPhone 6。

I am updating a project to iOS 8 and am running into this issue with one of my UITableViewCell implementations. Currently on Simulator and not a device and it is set to "iPhone 6".

*** Assertion failure in -[UITableViewCell _setHostsLayoutEngine:], /SourceCache/UIKit_Sim/UIKit-3318/NSLayoutConstraint_UIKitAdditions.m:2754
2014-09-15 10:43:52.890 BasketballStatTracker[10662:304085] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES.'

奇怪的是我在所有其他UITableViews中使用这个自定义UITableViewCell子类并且它正在工作没有任何断言。

The odd part is that I am using this Custom UITableViewCell subclass in all my other UITableViews and it is working well without any asserts.

这是cellForRowAtIndexPath:实现。

Here is the cellForRowAtIndexPath: implementation.

MyTableCell *cell =(MyTableCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
    cell =[[MyTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}

这是堆栈跟踪

0   CoreFoundation                      0x000000010844e3f5 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x00000001080e7bb7 objc_exception_throw + 45
2   CoreFoundation                      0x000000010844e25a +[NSException raise:format:arguments:] + 106
3   Foundation                          0x0000000107ac228f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4   UIKit                               0x0000000106de2e1c -[UIView(AdditionalLayoutSupport) _setHostsLayoutEngine:] + 188
5   UIKit                               0x00000001069e7d92 -[UITableViewCell _setupTableViewCellCommon] + 333
6   UIKit                               0x00000001069e84d7 -[UITableViewCell initWithCoder:] + 109
7   UIKit                               0x0000000106b8a996 UINibDecoderDecodeObjectForValue + 705

任何想法?

推荐答案

我找到了一个放置在视图层次结构中的错误UITableViewCell陷入困境的.xib。删除它修复了问题。

I located an errant UITableViewCell that was placed within the view hierarchy of the troubled .xib. Removing it fixed the problem.

这篇关于UITableViewCell抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆