gpt4 book ai didi

iphone - UITableView 崩溃给出 'CALayerInvalidGeometry' ,原因 : 'CALayer position contains NaN: [160 nan]'

转载 作者:行者123 更新时间:2023-12-03 18:19:41 26 4
gpt4 key购买 nike

我的应用程序中有一个自定义表格 View 。我已经在表中实现了“加载更多”功能,一次加载 25 行。问题是加载 2 次后,应用程序崩溃,给出“CALayerInvalidGeometry”,原因:“CALayer 位置包含 NaN:[160 nan]”,在 OS 4.2 及更高版本上出现错误。

在低于 4.2 的操作系统上,其中一个单元格丢失,并且表格中间有空白区域。它不会造成任何崩溃。但仍然出现上述错误。

我检查了我的代码中哪里可以出现除以 0 的情况,但我找不到任何除数。遵循我喜欢的堆栈跟踪。所以我什至无法检查这个异常发生在哪里。

有人有什么想法吗?

    0   CoreFoundation                      0x020ccbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x022215c2 objc_exception_throw + 47
2 CoreFoundation 0x02085628 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x0208559a +[NSException raise:format:] + 58
4 QuartzCore 0x0182396a _ZL18CALayerSetPositionP7CALayerRKN2CA4Vec2IdEEb + 177
5 QuartzCore 0x018238b5 -[CALayer setPosition:] + 42
6 QuartzCore 0x018237cc -[CALayer setFrame:] + 763
7 UIKit 0x0073c307 -[UIView(Geometry) setFrame:] + 255
8 UIKit 0x008c718a -[UITableViewCell setFrame:] + 166
9 UIKit 0x0077aa08 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 1160
10 UIKit 0x0077077f -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 75
11 UIKit 0x00785450 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1561
12 UIKit 0x0077d538 -[UITableView layoutSubviews] + 242
13 QuartzCore 0x01828451 -[CALayer layoutSublayers] + 181
14 QuartzCore 0x0182817c CALayerLayoutIfNeeded + 220
15 QuartzCore 0x0182137c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
16 QuartzCore 0x018210d0 _ZN2CA11Transaction6commitEv + 292
17 QuartzCore 0x018517d5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
18 CoreFoundation 0x020adfbb __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
19 CoreFoundation 0x020430e7 __CFRunLoopDoObservers + 295
20 CoreFoundation 0x0200bbd7 __CFRunLoopRun + 1575
21 CoreFoundation 0x0200b240 CFRunLoopRunSpecific + 208
22 CoreFoundation 0x0200b161 CFRunLoopRunInMode + 97
23 GraphicsServices 0x02611268 GSEventRunModal + 217
24 GraphicsServices 0x0261132d GSEventRun + 115
25 UIKit 0x0071542e UIApplicationMain + 1160

最佳答案

我遇到了同样的错误,因为我没有写

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { ... }

我写道:

- (NSInteger)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { ... }

(注意返回值)。希望这对某人有帮助。

关于iphone - UITableView 崩溃给出 'CALayerInvalidGeometry' ,原因 : 'CALayer position contains NaN: [160 nan]' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4820681/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com