我在我的项目中使用表视图,崩溃报告显示我的cellForRowAtIndexPath函数在花括号上崩溃,这无法帮助我找到错误。我无法在我的设备上或模拟器上重现此错误。堆栈跟踪位于下方,cellForRowAtIndexPath代码作为图像附加。
Crashlytics Stack-trace
Crashed: com.apple.main-thread
0 Synkers 0x104407d20 specialized HomeScreenViewController.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (HomeScreenViewController.swift:208)
1 Synkers 0x104404134 @objc HomeScreenViewController.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (HomeScreenViewController.swift)
2 UIKit 0x18a421474 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 668
3 UIKit 0x18a4219d8 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
4 UIKit 0x18a401670 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2140
5 UIKit 0x18a1bcf10 -[UITableView layoutSubviews] + 140
6 UIKit 0x18a0e9000 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1256
7 QuartzCore 0x184cb90b4 -[CALayer layoutSublayers] + 184
8 QuartzCore 0x184cbd194 CA::Layer::layout_if_needed(CA::Transaction*) + 332
9 QuartzCore 0x184c2bf24 CA::Context::commit_transaction(CA::Transaction*) + 336
10 QuartzCore 0x184c52340 CA::Transaction::commit() + 540
11 UIKit 0x18a0de884 _afterCACommitHandler + 256
12 CoreFoundation 0x180c838b8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
13 CoreFoundation 0x180c81270 __CFRunLoopDoObservers + 412
14 CoreFoundation 0x180c8182c __CFRunLoopRun + 1292
15 CoreFoundation 0x180ba22d8 CFRunLoopRunSpecific + 436
16 GraphicsServices 0x182a33f84 GSEventRunModal + 100
17 UIKit 0x18a14f880 UIApplicationMain + 208
18 Synkers 0x104215ba4 main (main.m:14)
19 libdyld.dylib 0x1806c656c start + 4
答案 0 :(得分:-3)
这与错误无关,但由于我的声誉太低,我不得不写回答:
永远不要强行取消牢房!
...forIndexPath: indexPath) as! ...
这可能会导致错误甚至崩溃