UITableView崩溃给出'CALayerInvalidGeometry',原因:'CALayer位置包含NaN:[160 nan]' [英] UITableView crash gives 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [160 nan]'
问题描述
我的应用中有自定义表格视图。我已经在表中实现了加载更多功能,一次加载25行。问题是在加载2次app崩溃后给出'CALayerInvalidGeometry',原因:'CALayer position包含NaN:[160 nan]'作为OS 4.2及以上版本的错误。
I have a custom table view in my app. I have implemented the "Load More" feature to the table which loads 25 rows at a time. The problem is after loading 2 times the app crashes giving 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [160 nan]' as error on OS 4.2 and above.
在操作系统低于4.2时,其中一个单元格丢失,表格中间有空格。它不会造成任何崩溃。但是它仍然给出了上面提到的错误。
On OS below 4.2 one of the cell goes missing and there is blank space between in the middle of the table. It do not give any crash. But it still gives the error mentioned above.
我检查看看除了0可以在我的代码中发生的地方,但我找不到任何。跟随堆栈跟踪我喜欢。所以我甚至无法检查这个异常发生的位置。
I check to see where can the division by 0 can occur in my code but i couldnt find any. Following the stack trace i fond. So i cannot even check where this exception is happening.
任何人都有任何想法??
Anybody have any idea ??
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
推荐答案
我有同样的错误,因为而不是写
I had this same exact error because instead of writing
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { ... }
我写的:
- (NSInteger)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { ... }
(注意返回值)。
希望这有助于某人。
(notice the return value). Hope this helps somebody.
这篇关于UITableView崩溃给出'CALayerInvalidGeometry',原因:'CALayer位置包含NaN:[160 nan]'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!