我在现场有一个应用程序在 iOS 11 的某个时候开始崩溃,并显示以下消息:
CRASH: Engine marked as needing optimization even though it's already in progress.
崩溃发生在 UIKit -> Foundation -> CoreFoundation -> libocj.A.dylib -> CoreFoundation
中的某处,但我得到的崩溃日志是经过编辑的,所以我不知道更多比起那个来说。我通常对它们进行符号化,但符号化仅适用于我的应用程序,不适用于库代码,因此我需要从现场运送到这里的设备获取设备的完整崩溃日志。
在那之前,有没有人知道什么会导致这种崩溃,或者有什么好的起点可以开始调查?
0 CoreFoundation exceptionPreprocess (in CoreFoundation) + 148
1 libobjc.A.dylib objc_exception_throw + 56
2 CoreFoundation +[NSException raise:format:] (in CoreFoundation) + 0
3 Foundation -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] (in Foundation) + 112
4 Foundation -[NSISEngine _optimizeIfNotDisabled] (in Foundation) + 320
5 Foundation -[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] (in Foundation) + 664
6 Foundation -[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] (in Foundation) + 284
7 Foundation -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] (in Foundation) + 272
8 UIKit -[UIView(UIConstraintBasedLayout) _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] (in UIKit) + 488
9 UIKit -[UIView(UIConstraintBasedLayout) _tryToAddConstraintWithoutUpdatingConstraintsArray:roundingAdjustment:mutuallyExclusiveConstraints:] (in UIKit) + 36
10 UIKit -[UIView(UIConstraintBasedLayout) _updateContentSizeConstraints] (in UIKit) + 696
11 UIKit -[UIView(AdditionalLayoutSupport) _updateSystemConstraints] (in UIKit) + 112
12 UIKit -[UIView(AdditionalLayoutSupport) _sendUpdateConstraintsIfNecessaryForSecondPass:] (in UIKit) + 188
13 UIKit -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] (in UIKit) + 1008
14 UIKit -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] (in UIKit) + 712
15 UIKit -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] (in UIKit) + 712
16 UIKit -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] (in UIKit) + 712
17 Foundation -[NSISEngine withBehaviors:performModifications:] (in Foundation) + 168
18 UIKit 100-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke (in UIKit) + 92
19 UIKit -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] (in UIKit) + 116
20 UIKit -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] (in UIKit) + 168
21 UIKit -[UIWindow(UIConstraintBasedLayout) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] (in UIKit) + 104
22 UIKit -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] (in UIKit) + 428
23 UIKit -[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] (in UIKit) + 180
24 UIKit -[UIView(CALayerDelegate) layoutSublayersOfLayer:] (in UIKit) + 1276
25 QuartzCore -[CALayer layoutSublayers] (in QuartzCore) + 184
26 QuartzCore CA::Layer::layout_if_needed(CA::Transaction*) (in QuartzCore) + 332
27 QuartzCore CA::Context::commit_transaction(CA::Transaction*) (in QuartzCore) + 336
28 QuartzCore CA::Transaction::commit() (in QuartzCore) + 540
29 QuartzCore CA::Transaction::observer_callback(CFRunLoopObserver*, unsigned long, void*) (in QuartzCore) + 92
30 CoreFoundation CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ (in CoreFoundation) + 32
31 CoreFoundation CFRunLoopDoObservers (in CoreFoundation) + 412
32 CoreFoundation CFRunLoopRun (in CoreFoundation) + 1292
33 CoreFoundation CFRunLoopRunSpecific + 436
34 GraphicsServices GSEventRunModal + 100
35 UIKit UIApplicationMain + 208
36 ios-app main (main.m:27)
37 libdyld.dylib start (in libdyld.dylib) + 4
最佳答案
这question made 让我仔细检查我的崩溃日志。似乎这一切都来自后台线程进行的 UIKit
调用。
Xcode 9 现在会在调试您的应用程序时向您指出,并且会从非主线程调用此类调用。试试吧。
在我的例子中,它更容易,因为我在崩溃的线程中看到 UIAlertController
,所以我可以缩小对这些调用的搜索范围。
关于ios - 崩溃 : Engine Marked As Needing Optimization,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47288107/