【发布时间】:2018-01-17 16:56:54
【问题描述】:
在低于 iOS 11 的任何版本中,我的应用总是在 2 个不同的地方崩溃。
其中一个崩溃是 EXC_BREAKPOINT 在 appDelegate 类定义行上中断 - class AppDelegate: UIResponder, UIApplicationDelegate {}
而另一个在简单的 segmentedControl?.removeAllSegments() 上使用 EXC_BREAKPOINT 崩溃(是的,我检查了 segmentedControl 是否为空;它不是)。
有趣的是,我在 2/3 周前从未遇到过这个问题,而且我知道我没有从这两个地方更改任何代码行。
调试器只是这样说:“-[UILayoutGuide nsli_superitem]: message sent to deallocated instance 0x600000386db0”
这是堆栈跟踪:
0 0x000000010a79c92e _T09 30SegmentedControlViewControllerC05setupcD0yyF + 126 1 0x000000010a79c6df _T0930SegmentedControlViewControllerC05setupE0yyF + 511 2 0x000000010a5dba30 _T0929MasterStockInfoViewControllerC11viewDidLoadyyF + 624 3 0x000000010a5dbb04 _T0929MasterStockInfoViewControllerC11viewDidLoadyyFTo + 36 4 UIKit 0x000000010bec101a-[UIViewController loadViewIfRequired] + 1235 5 UIKit 0x000000010bec73a6-[UIViewController viewWillAppear:] + 118 6 UIKit 0x000000010bef13c8-[UINavigationController _startCustomTransition:] + 1305 7 UIKit 0x000000010bf01967-[UINavigationController _startDeferredTransitionIfNeeded:] + 687 8 UIKit 0x000000010bf02b41-[UINavigationController __viewWillLayoutSubviews] + 58 9 UIKit 0x000000010c0f460c-[UILayoutContainerView layoutSubviews] + 231 10 UIKit 0x000000010bde155b-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1268 11 QuartzCore 0x000000010ec60904 -[CALayer layoutSublayers] + 146 12 石英核心 0x000000010ec54526 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 370 13 石英核心 0x000000010ec543a0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 14 石英核心 0x000000010ebe3e92 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294 15 石英核心 0x000000010ec10130 _ZN2CA11Transaction6commitEv + 468 16 石英核心 0x000000010ec10b37 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 115 17 核心基础 0x000000010e00a717 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 18 核心基础 0x000000010e00a687 __CFRunLoopDoObservers + 391 19 核心基础 0x000000010dfef720 __CFRunLoopRun + 1200 20 核心基础 0x000000010dfef016 CFRunLoopRunSpecific + 406 21 图形服务 0x00000001117bba24 GSEventRunModal + 62 22 UIKit 0x000000010bd1e134 UIApplicationMain + 159 23 0x000000010a7c2257 主要 + 55 24 libdyld.dylib 0x000000010f6bd65d 开始 + 1
任何有关这方面的信息都会有所帮助,目前正在探索所有选项。如果您需要这方面的更多信息,请发表评论,我会立即回复您。 谢谢
【问题讨论】:
-
你在 Xcode 中设置了异常断点吗?可能值得关闭它,因为它可能会导致非致命性。
-
我没有,它在 iPhone 设备和模拟器上崩溃。该应用正在生产中,我们正在收到用户的崩溃报告。
-
EXC_BREAKPOINTinappDelegate可能意味着很多事情。它可能是无效的约束(如果您使用 autoLayout,则为 idk)。它可能正在使用不安全的展开并找到一个 nil 值。它可能以意想不到的方式使用 CoreGraphics。您需要一些步骤来重现此错误,以便了解它的来源(并缩小搜索范围)。message sent to deallocated instance让我认为您可能有一些委托/数据源仍被已解除分配的对象引用。我遇到了类似的错误,将 dataSources 和 delegates 分配给 nil 解决了它。 -
你是如何展示你的观点的?快照套件?故事板自动约束?...
-
@Nathaniel 是的,我正在使用 Storyboard 自动布局
标签: ios swift uisegmentedcontrol nsexception uilayoutguide