【问题标题】:How to understand this crash log? SIGSEGV如何理解这个崩溃日志? SIGSEGV
【发布时间】:2017-02-15 17:52:40
【问题描述】:

该应用最近崩溃了,我没能理解崩溃日志。

崩溃只发生在 iPhone 5s SDK:9.1 上,我无法在模拟器或其他 SDK 版本的其他设备上重现它..

Crashed Thread: 0
0   libobjc.A.dylib                     0x1993b5bdc objc_msgSend (in libobjc.A.dylib) + 28
1   UIKit                               0x18a45bfb4 -[UINibStringIDTable lookupKey:identifier:] (in UIKit) + 132
2   UIKit                               0x18a457c04 -[UINibDecoder decodeObjectForKey:] (in UIKit) + 48
3   UIKit                               0x18a339030 -[UINib instantiateWithOwner:options:] (in UIKit) + 1416
4   UIKit                               0x189fc01b8 -[UITableView _dequeueReusableViewOfType:withIdentifier:] (in UIKit) + 552
5   MyApp                               0x10028a160 -[HomeVC loadStandardContentCellOnTableView:cellForRowAtIndexPath:] (in MyApp) (HomeVC.m:1604)
6   MyApp                               0x10028737c -[HomeVC tableView:cellForRowAtIndexPath:] (in MyApp) (HomeVC.m:1198)
7   UIKit                               0x18a1c220c -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] (in UIKit) + 688
8   UIKit                               0x18a1c2364 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] (in UIKit) + 80
9   UIKit                               0x18a1b17b8 -[UITableView _updateVisibleCellsNow:isRecursive:] (in UIKit) + 2440
10  UIKit                               0x18a1c6f0c -[UITableView _performWithCachedTraitCollection:] (in UIKit) + 104
11  UIKit                               0x189f5f22c -[UITableView layoutSubviews] (in UIKit) + 176
12  UIKit                               0x189e6f7ac -[UIView(CALayerDelegate) layoutSublayersOfLayer:] (in UIKit) + 644
13  QuartzCore                          0x18966eb58 -[CALayer layoutSublayers] (in QuartzCore) + 148
14  QuartzCore                          0x189669764 CA::Layer::layout_if_needed(CA::Transaction*) (in QuartzCore) + 292
15  UIKit                               0x189e862fc -[UIView(Hierarchy) layoutBelowIfNeeded] (in UIKit) + 884
16  UIKit                               0x189f339e4 -[UINavigationController _layoutViewController:] (in UIKit) + 1196
17  UIKit                               0x189f313bc -[UINavigationController _layoutTopViewController] (in UIKit) + 228
18  UIKit                               0x189f49fb4 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] (in UIKit) + 728
19  UIKit                               0x189f49ca0 -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:] (in UIKit) + 416
20  UIKit                               0x189f499a8 -[UINavigationTransitionView _cleanupTransition] (in UIKit) + 744
21  UIKit                               0x189eaed3c -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] (in UIKit) + 312
22  UIKit                               0x189eacfb8 +[UIViewAnimationState popAnimationState] (in UIKit) + 324
23  UIKit                               0x189f3d4c4 -[UINavigationTransitionView transition:fromView:toView:] (in UIKit) + 1792
24  UIKit                               0x189f33098 -[UINavigationController _startTransition:fromViewController:toViewController:] (in UIKit) + 2696
25  UIKit                               0x189f32244 -[UINavigationController _startDeferredTransitionIfNeeded:] (in UIKit) + 868
26  UIKit                               0x189f31e6c -[UINavigationController __viewWillLayoutSubviews] (in UIKit) + 60
27  UIKit                               0x189f31dd4 -[UILayoutContainerView layoutSubviews] (in UIKit) + 208
28  UIKit                               0x189e6f7ac -[UIView(CALayerDelegate) layoutSublayersOfLayer:] (in UIKit) + 644
29  QuartzCore                          0x18966eb58 -[CALayer layoutSublayers] (in QuartzCore) + 148
30  QuartzCore                          0x189669764 CA::Layer::layout_if_needed(CA::Transaction*) (in QuartzCore) + 292
31  QuartzCore                          0x189669624 CA::Layer::layout_and_display_if_needed(CA::Transaction*) (in QuartzCore) + 32
32  QuartzCore                          0x189668cc0 CA::Context::commit_transaction(CA::Transaction*) (in QuartzCore) + 252
33  QuartzCore                          0x189668a08 CA::Transaction::commit() (in QuartzCore) + 512
34  QuartzCore                          0x1896620f8 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) (in QuartzCore) + 80
35  CoreFoundation                      0x184897bd0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ (in CoreFoundation) + 32
36  CoreFoundation                      0x184895974 __CFRunLoopDoObservers (in CoreFoundation) + 372
37  CoreFoundation                      0x184895da4 __CFRunLoopRun (in CoreFoundation) + 928
38  CoreFoundation                      0x1847c4ca0 CFRunLoopRunSpecific (in CoreFoundation) + 384
39  GraphicsServices                    0x18fa00088 GSEventRunModal (in GraphicsServices) + 180
40  UIKit                               0x189edcffc UIApplicationMain (in UIKit) + 204
41  MyApp                               0x100272ea4 main (in MyApp) (main.m:47)

我不明白这次崩溃背后的真正原因是什么。有什么想法吗?

【问题讨论】:

  • 我认为您的cellForRowAtIndexPath 方法在您的HomeVC 中可能有问题。您应该在实例化单元格时设置一个断点,我认为这是应用程序崩溃的地方。
  • @StefanStefanov 我并没有崩溃。我无法重现此错误,我认为它可能与旧的 SDK 或其他什么有关系..
  • 我很确定您将单元格出列的方式有问题。也许您为此使用了已弃用的方法?
  • @StefanStefanov 这是我用于使单元格出列的代码:HomeContentCell * homeContentCell = [tableView dequeueReusableCellWithIdentifier:@"HomeContentCellID"];
  • 这就是问题所在。你应该打电话给dequeueReusableCellWithIdentifier:forIndexPath:。否则你的单元格可以是nil

标签: ios objective-c crash crash-reports


【解决方案1】:

您正在使用一种已弃用的方法来使您的单元格出列。你应该使用dequeueReusableCellWithIdentifier:forIndexPath:,而不是使用dequeueReusableCellWithIdentifier:

【讨论】:

  • 我认为它实际上并没有被弃用,尽管可以肯定的是,使用较新的方法更容易,因为它总是返回一个非空值。尤其是在 Swift 中,差异是显着的,因为使用 forIndexPath 变体意味着结果不是可选的,因此您不必打开它:``` func dequeueReusableCellWithIdentifier(identifier: String) -> UITableViewCell? func dequeueReusableCellWithIdentifier(identifier: String, forIndexPath indexPath: NSIndexPath) -> UITableViewCell```
【解决方案2】:

SIGSEGV:- 这是一个分段错误。更多详情SegmentationFault

以下这些方法存在问题:-

5 MyApp 0x10028a160 -[HomeVC loadStandardContentCellOnTableView:cellForRowAtIndexPath:] (in MyApp) (HomeVC.m:1604) 6 MyApp 0x10028737c -[HomeVC tableView:cellForRowAtIndexPath:] (in MyApp) (HomeVC.m:1198)

在 loadStandardContentCellOnTableView 中放置断点并调试。其他行的堆栈跟踪与苹果方法有关。

【讨论】:

  • 它并没有在我这边崩溃。我无法重现这个错误,我认为它可能与旧的 SDK 或其他东西有关系(我在模拟器上用 9.1 SDK 测试过它,它工作得很好)..
猜你喜欢
  • 2012-10-30
  • 1970-01-01
  • 2011-01-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多