什么是崩溃的原因"崩溃:com.apple.main-thread EXC_BREAKPOINT"

时间:2017-06-01 12:38:11

标签: ios swift swift3 crashlytics

我在crashlytics(fabric)上遇到此崩溃,但无法根据回溯重现它或了解其来源。

Crashed: com.apple.main-thread
0  MyApp                          0x1001080a0 MyViewController.viewWillAppear(Bool) -> () (MyViewController.swift:135)
1  MyApp                          0x1001080d0 @objc MyViewController.viewWillAppear(Bool) -> () (MyViewController.swift)
2  UIKit                          0x18868bbf4 -[UIViewController _setViewAppearState:isAnimating:] + 632
3  UIKit                          0x18868b964 -[UIViewController __viewWillAppear:] + 156
4  UIKit                          0x1888101d4 -[UINavigationController _startCustomTransition:] + 1144
5  UIKit                          0x18872ab78 -[UINavigationController _startDeferredTransitionIfNeeded:] + 676
6  UIKit                          0x18872a7e0 -[UINavigationController __viewWillLayoutSubviews] + 64
7  UIKit                          0x18872a744 -[UILayoutContainerView layoutSubviews] + 188
8  UIKit                          0x18867107c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1200
9  QuartzCore                     0x185861274 -[CALayer layoutSublayers] + 148
10 QuartzCore                     0x185855de8 CA::Layer::layout_if_needed(CA::Transaction*) + 292
11 QuartzCore                     0x185855ca8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
12 QuartzCore                     0x1857d134c CA::Context::commit_transaction(CA::Transaction*) + 252
13 QuartzCore                     0x1857f83ac CA::Transaction::commit() + 504
14 UIKit                          0x1888f2524 _UIApplicationFlushRunLoopCATransactionIfTooLate + 172
15 UIKit                          0x188e689f8 __handleEventQueue + 4916
16 UIKit                          0x188e68b9c __handleHIDEventFetcherDrain + 148
17 CoreFoundation                 0x1824f142c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
18 CoreFoundation                 0x1824f0d9c __CFRunLoopDoSources0 + 540
19 CoreFoundation                 0x1824ee9a8 __CFRunLoopRun + 744
20 CoreFoundation                 0x18241eda4 CFRunLoopRunSpecific + 424
21 GraphicsServices               0x183e88074 GSEventRunModal + 100
22 UIKit                          0x1886d9058 UIApplicationMain + 208
23 MyApp                          0x1009052fc main (AppDelegate.swift:16)
24 libdyld.dylib                  0x18142d59c start + 4

MyViewController中的代码:

@IBOutlet weak var someConstraint: NSLayoutConstraint!
@IBOutlet weak var button: UIButton! 
let minHeight: CGFloat = 2.0
let cValue: CGFloat = 32.0

override func viewWillAppear(_ animated: Bool) {
  super.viewWillAppear(animated)

  let aValue = button.frame.origin.y - UIApplication.shared.statusBarFrame.height
  let bValue = button.bounds.height + minHeight
  someConstraint.constant = max(aValue - bValue, cValue) // --> Crash here, line 135
}

更新:SomeConstraint不是零。

0 个答案:

没有答案