Re: debugging AutoLayout exception with no build errors
Re: debugging AutoLayout exception with no build errors
- Subject: Re: debugging AutoLayout exception with no build errors
- From: Ken Thomases <email@hidden>
- Date: Thu, 05 Nov 2015 07:33:19 -0600
It's definitely encountering unsatisfiable constraints. It's trying to log the problem, but getting an exception while composing a description string for one of the constraints.
This is happening when the view is being added to its window. You've truncated the stack trace so we can't tell why/when that's happening. Could it be that the window has a minimum or maximum size that's conflicting with the size the view wants to be? A view is likely to lay out to a slightly different size on 10.9 vs. 10.10 or 10.11 because of system font changes.
You could break on the exception or set a breakpoint on -[NSView(NSConstraintBasedLayout) engine:willBreakConstraint:dueToMutuallyExclusiveConstraints:]. Either way, select that frame of the stack. Then, try to examine the third parameter, which seems like it would be the array of constraints. You won't be able to request the array's description (for example, using "po"), because that's precisely what's failing. You'll have to examine the elements and their properties.
-Ken
> On Nov 4, 2015, at 9:19 AM, 2551 <email@hidden> wrote:
>
> I have an OSX app built on 10.11.1, deployment target 10.9. The app builds and runs without any AutoLayout issues or warnings from Xcode. I have ambiguities turned on.
>
> The problem is when I try to run the app on 10.9. Although the app will run without fatally crashing, one of its main windows won’t open. In Console, on launch I first see the message
>
>
> “Unable to create description in descriptionForLayoutAttribute_layoutItem_coefficient. Something is nil.”
>
>
> If I then try to open the window from a menu command, I get the stacktrace (relevant part appended below). I see the ‘mutually exclusive’ error starting at line 18 in the trace, but I’ve manually been through the constraints and can’t see any conflicts. I’ve also removed all constraints and had Xcode do “Add Missing Constraints” after that. Again, no AutoLayout errors on build, but still the mutually exclusive exception occurs on 10.9.
>
> Does anyone have any debugging tips as to how do I can find the source of the problem when neither Xcode nor Console on my build machine make any complaints?
>
>
> Best
>
>
> Phil
>
>
>
>
>
> 0 CoreFoundation 0x00007fff9497025c __exceptionPreprocess + 172
>
> 1 libobjc.A.dylib 0x00007fff92de3e75 objc_exception_throw + 43
>
> 2 CoreFoundation 0x00007fff9497010c +[NSException raise:format:] + 204
>
> 3 Foundation 0x00007fff8f98cc55 descriptionForLayoutAttribute_layoutItem_coefficient + 145
>
> 4 Foundation 0x00007fff8f98caaf -[NSLayoutConstraint equationDescription] + 215
>
> 5 Foundation 0x00007fff8f98cf3e -[NSLayoutConstraint description] + 298
>
> 6 CoreFoundation 0x00007fff949620e1 -[NSArray descriptionWithLocale:indent:] + 481
>
> 7 Foundation 0x00007fff8f7517bb _NSDescriptionWithLocaleFunc + 64
>
> 8 CoreFoundation 0x00007fff9485ece4 __CFStringAppendFormatCore + 7332
>
> 9 CoreFoundation 0x00007fff9488d263 _CFStringCreateWithFormatAndArgumentsAux + 115
>
> 10 CoreFoundation 0x00007fff948c4aeb _CFLogvEx + 123
>
> 11 Foundation 0x00007fff8f77b32c NSLogv + 79
>
> 12 Foundation 0x00007fff8f77b2b8 NSLog + 148
>
> 13 AppKit 0x00007fff8f1dc194 -[NSView(NSConstraintBasedLayout) engine:willBreakConstraint:dueToMutuallyExclusiveConstraints:] + 114
>
> 14 Foundation 0x00007fff8f98713e -[NSISEngine handleUnsatisfiableRowWithHead:body:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 507
>
> 15 Foundation 0x00007fff8f98789c -[NSISEngine tryUsingArtificialVariableToAddConstraintWithMarker:rowBody:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 379
>
> 16 Foundation 0x00007fff8f784e89 -[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] + 663
>
> 17 Foundation 0x00007fff8f98d897 -[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] + 285
>
> 18 Foundation 0x00007fff8f7792cf -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 204
>
> 19 AppKit 0x00007fff8e97520b __52-[NSView(NSConstraintBasedLayout) _setLayoutEngine:]_block_invoke_2 + 411
>
> 20 Foundation 0x00007fff8f7873aa -[NSISEngine withBehaviors:performModifications:] + 119
>
> 21 AppKit 0x00007fff8e8d795c -[NSView(NSConstraintBasedLayout) _withAutomaticEngineOptimizationDisabled:] + 66
>
> 22 AppKit 0x00007fff8e975049 __52-[NSView(NSConstraintBasedLayout) _setLayoutEngine:]_block_invoke + 433
>
> 23 AppKit 0x00007fff8e8da4fa -[NSView(NSConstraintBasedLayout) _setLayoutEngine:] + 229
>
> 24 AppKit 0x00007fff8e975122 __52-[NSView(NSConstraintBasedLayout) _setLayoutEngine:]_block_invoke_2 + 178
>
> 25 Foundation 0x00007fff8f7873aa -[NSISEngine withBehaviors:performModifications:] + 119
>
> 26 AppKit 0x00007fff8e8d795c -[NSView(NSConstraintBasedLayout) _withAutomaticEngineOptimizationDisabled:] + 66
>
> 27 AppKit 0x00007fff8e975049 __52-[NSView(NSConstraintBasedLayout) _setLayoutEngine:]_block_invoke + 433
>
> 28 AppKit 0x00007fff8e8da4fa -[NSView(NSConstraintBasedLayout) _setLayoutEngine:] + 229
>
> 29 AppKit 0x00007fff8e97ab9e make_and_host_engine + 256
>
> 30 AppKit 0x00007fff8e97a8e7 -[NSView(NSConstraintBasedLayout) _didChangeHostsAutolayoutEngineTo:] + 165
>
> 31 AppKit 0x00007fff8e91ccce -[NSView(NSConstraintBasedLayout) _engageAutolayout] + 81
>
> 32 AppKit 0x00007fff8e91cceb -[NSView(NSConstraintBasedLayout) _engageAutolayout] + 110
>
> 33 AppKit 0x00007fff8e8e240a -[NSView(NSConstraintBasedLayout) _layoutEngine_windowDidChange] + 87
>
> 34 AppKit 0x00007fff8f01c8ee __21-[NSView _setWindow:]_block_invoke643 + 67
>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden