33

My app breaks a constraint when I present the "Call-in" status bar by pressing Command+Y in the simulator. It only happens the first time it presents the call-in bar. Everything looks as it supposed to, but the log prints out the following:

Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x7fb4cb9b2b60 V:|-(20)-[UIInputSetContainerView:0x7fb4cb9b1190]   (Names: '|':UITextEffectsWindow:0x7fb4cba003f0 )>",
    "<NSLayoutConstraint:0x7fb4cb942100 'UIInputWindowController-top' V:|-(0)-[UIInputSetContainerView:0x7fb4cb9b1190]   (Names: '|':UITextEffectsWindow:0x7fb4cba003f0 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fb4cb9b2b60 V:|-(20)-[UIInputSetContainerView:0x7fb4cb9b1190]   (Names: '|':UITextEffectsWindow:0x7fb4cba003f0 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

This is the call stack when it breaks for UIViewAlertForUnsatisfiableConstraints:

* thread #1: tid = 0x17582f, 0x0000000109bbb4c6 UIKit`UIViewAlertForUnsatisfiableConstraints, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
    frame #0: 0x0000000109bbb4c6 UIKit`UIViewAlertForUnsatisfiableConstraints
    frame #1: 0x0000000109bbb8b2 UIKit`-[UIView(UIConstraintBasedLayout_EngineDelegate) engine:willBreakConstraint:dueToMutuallyExclusiveConstraints:] + 113
    frame #2: 0x0000000107ea672b Foundation`-[NSISEngine handleUnsatisfiableRowWithHead:body:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 489
    frame #3: 0x0000000107d07801 Foundation`-[NSISEngine fixUpValueRestrictionViolationsWithInfeasibilityHandlingBehavior:] + 613
    frame #4: 0x0000000107d07537 Foundation`-[NSISEngine optimize] + 134
    frame #5: 0x0000000107d07da4 Foundation`-[NSISEngine withBehaviors:performModifications:] + 245
    frame #6: 0x0000000109bb5a4b UIKit`-[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 58
    frame #7: 0x0000000109bb658e UIKit`-[UIView(AdditionalLayoutSupport) updateConstraintsIfNeeded] + 254
    frame #8: 0x0000000109ba6c46 UIKit`-[UIWindow(UIConstraintBasedLayout) updateConstraintsIfNeeded] + 108
    frame #9: 0x0000000109bb72a3 UIKit`-[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeeded] + 272
    frame #10: 0x00000001093979b3 UIKit`-[UIView(Hierarchy) layoutBelowIfNeeded] + 845
    frame #11: 0x000000010936eb8b UIKit`-[UIWindow handleStatusBarChangeFromHeight:toHeight:] + 1284
    frame #12: 0x0000000109703b5b UIKit`-[UITextEffectsWindow handleStatusBarChangeFromHeight:toHeight:] + 100
  * frame #13: 0x00000001093726a7 UIKit`+[UIWindow _noteStatusBarHeightChanged:oldHeight:forAutolayoutRootViewsOnly:] + 364
    frame #14: 0x0000000109303a52 UIKit`-[UIApplication statusBar:willAnimateFromHeight:toHeight:duration:animation:] + 265
    frame #15: 0x00000001099115bb UIKit`-[UIStatusBar _requestStyleAttributes:animationParameters:forced:] + 885
    frame #16: 0x0000000109910fbf UIKit`-[UIStatusBar requestStyle:animationParameters:forced:] + 437
    frame #17: 0x0000000109910d0d UIKit`-[UIStatusBar requestStyle:animated:forced:] + 90
    frame #18: 0x00000001099160a6 UIKit`-[UIStatusBar statusBarServer:didReceiveStyleOverrides:] + 56
    frame #19: 0x0000000109904b05 UIKit`_UIStatusBarReceivedStyleOverrides + 45
    frame #20: 0x0000000109909058 UIKit`_XReceivedStyleOverrides + 33
    frame #21: 0x0000000110d67fa8 AppSupport`migHelperRecievePortCallout + 208
    frame #22: 0x000000010896c289 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
    frame #23: 0x000000010896c1f9 CoreFoundation`__CFRunLoopDoSource1 + 473
    frame #24: 0x0000000108961970 CoreFoundation`__CFRunLoopRun + 2272
    frame #25: 0x0000000108960e08 CoreFoundation`CFRunLoopRunSpecific + 488
    frame #26: 0x000000010e360ad2 GraphicsServices`GSEventRunModal + 161
    frame #27: 0x00000001092f330d UIKit`UIApplicationMain + 171
    frame #28: 0x00000001074e252f AppName`main(argc=1, argv=0x00007fff5872e688) + 111 at main.m:16
    frame #29: 0x000000010aa6b92d libdyld.dylib`start + 1
    frame #30: 0x000000010aa6b92d libdyld.dylib`start + 1

Do you have any idea why the constraint breaks? I haven't added any constraints to the UIInputSetContainerView, UITextEffectsWindow or UIInputWindowController.

EDIT: My question has been marked as a possible duplicate, but I DO NOT recommend or agree with the answer that is provided in the other question. It is very risky to remove Apple's own constraints, just to get rid of this warning. I would not recommend doing that. Which is why I also find the duplicate flag wrong (This question has been asked before and already has an answer.), because the answer is not the one I am looking for.

Community
  • 1
  • 1
ThomasCle
  • 6,792
  • 7
  • 41
  • 81
  • 3
    What constraints have you added ? I suspect a constraint is added at runtime by the system probably because of an interface builder setting. The constraints though are conflicting as you can see in the log – Lefteris Oct 26 '15 at 12:35
  • is there a chance that status bar pushes the window 20px down ? – Teja Nandamuri Oct 26 '15 at 12:37
  • @Lefteris I don't add any constraint to the views that have conflicting constraints. – ThomasCle Oct 26 '15 at 12:45
  • @Mr.T That is exactly what the call-in status bar does. It adds 20 pixels to the status bar height and pushes the view down. But this is how Apple has designed their status bar. But I don't understand why it breaks constraints that I haven't created. – ThomasCle Oct 26 '15 at 12:45
  • Are you adding constraint to other windows or to the rootController of a window? Maybe you are adding constraints to the keyboard window by mistake because you want to access your app window but instead you are accessing the keyboard window. – Sulthan Oct 26 '15 at 13:05
  • @Sulthan Nope, I am only creating the window, setting the `rootViewController` and calling `[self.window makeKeyAndVisible]`. That is pretty much all I do with the window. – ThomasCle Oct 26 '15 at 13:26
  • @ThomasClemensen, regarding EDIT. Hey, it looks like this might be just a bug as discussed in this Dev forum thread, taken from the potential duplicate answer, that is why I was okay with removing just the conflicting constraints for now, you can find the thread here: https://forums.developer.apple.com/thread/20632. Any updates on this? – serge-k Feb 25 '16 at 03:58
  • @serge-k "removing the conflicting constraints for now" is still dangerous and will leave your app in a uncertain state. You don't know when Apple will fix this and when they do you might be removing constraints you should not have. That is just my opinion. – ThomasCle Feb 25 '16 at 07:39
  • @ThomasClemensen I agree, just don't know what else to do. If I make a blank, brand new single view project, don't add anything at all, then run it on the simulator, toggle in the in-call status bar, I get the constraint conflict. Also, one could argue the way the constraint conflict is eventually solved is by "breaking one of the constraints". – serge-k Feb 25 '16 at 16:41
  • @ThomasClemensen I did quite a bit of testing today. Update my answer on the other post. Let me know what you think. – serge-k Feb 25 '16 at 23:33

2 Answers2

16

Looks like it is an Apple bug. You can verify that it happens on a totally empty template project:

  • Create new single view project
  • Run on iPhone simulator
  • press Cmd-Y to toggle the status-bar

You'll see the constraint break.

Radar is the way to go I would say.

amadour
  • 1,600
  • 11
  • 20
4

This is clearly an Apple bug. My guess is that they have an errant constraint that holds the status bars height at 20 px but is broken when the call bar grows. This doesn't break or affect the app so it can safely be ignored for now. But an Apple Radar should be filled.

Daniel Popov
  • 161
  • 5