UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: Is there a simple way to fix this error?

Forums > 100 Days of SwiftUI

Every time I use .navigationTitle as instructed in this course, I get this giant error message in the debugger/output area.

Even on code as simple as this...

struct ContentView: View {
  NavigationView {
    Text("Hello, world!")
      .navigationTitle("Best App Ever")
  }
}

Is there something I should be doing differently to avoid seeing this error? The apps still build and compile fine. It is just annoying clutter that I would prefer to avoid seeing if there is a simple solution.

Error Message: 2022-08-28 18:59:14.045700-0600 iExpense[70171:2025976] [LayoutConstraints] 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:0x600003cad2c0 'BIB_Leading_Leading' H:|-(0)-[_UIModernBarButton:0x7fe5d7f20890] (active, names: '|':_UIButtonBarButton:0x7fe5d7f1cec0 )>", "<NSLayoutConstraint:0x600003cae030 'UINav_static_button_horiz_position' _UIModernBarButton:0x7fe5d7f20890.leading == UILayoutGuide:0x60000269d260'UIViewLayoutMarginsGuide'.leading (active)>", "<NSLayoutConstraint:0x600003cae080 'UINavItemContentGuide-leading' H:[_UIButtonBarButton:0x7fe5d7f1cec0]-(6)-[UILayoutGuide:0x60000269d180'UINavigationBarItemContentLayoutGuide'] (active)>", "<NSLayoutConstraint:0x600003cb32a0 'UINavItemContentGuide-trailing' UILayoutGuide:0x60000269d180'UINavigationBarItemContentLayoutGuide'.trailing == _UINavigationBarContentView:0x7fe5d7f1b4f0.trailing (active)>", "<NSLayoutConstraint:0x600003caf980 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x7fe5d7f1b4f0.width == 0 (active)>", "<NSLayoutConstraint:0x600003cb35c0 'UIView-leftMargin-guide-constraint' H:|-(8)-UILayoutGuide:0x60000269d260'UIViewLayoutMarginsGuide' (active, names: '|':_UINavigationBarContentView:0x7fe5d7f1b4f0 )>" )

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x600003cad2c0 'BIB_Leading_Leading' H:|-(0)-[_UIModernBarButton:0x7fe5d7f20890] (active, names: '|':_UIButtonBarButton:0x7fe5d7f1cec0 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful. 2022-08-28 18:59:14.046839-0600 iExpense[70171:2025976] [LayoutConstraints] 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:0x600003cac7d0 UIView:0x7fe5d7f259e0.trailing == _UIBackButtonMaskView:0x7fe5d7f15ef0.trailing (active)>", "<NSLayoutConstraint:0x600003cad900 'Mask_Trailing_Trailing' _UIBackButtonMaskView:0x7fe5d7f15ef0.trailing == _UIButtonBarButton:0x7fe5d7f1cec0.trailing (active)>", "<NSLayoutConstraint:0x600003cada40 'MaskEV_Leading_BIB_Trailing' H:[_UIModernBarButton:0x7fe5d7f20890]-(0)-[UIView:0x7fe5d7f259e0] (active)>", "<NSLayoutConstraint:0x600003cae030 'UINav_static_button_horiz_position' _UIModernBarButton:0x7fe5d7f20890.leading == UILayoutGuide:0x60000269d260'UIViewLayoutMarginsGuide'.leading (active)>", "<NSLayoutConstraint:0x600003cae080 'UINavItemContentGuide-leading' H:[_UIButtonBarButton:0x7fe5d7f1cec0]-(6)-[UILayoutGuide:0x60000269d180'UINavigationBarItemContentLayoutGuide'] (active)>", "<NSLayoutConstraint:0x600003cb32a0 'UINavItemContentGuide-trailing' UILayoutGuide:0x60000269d180'UINavigationBarItemContentLayoutGuide'.trailing == _UINavigationBarContentView:0x7fe5d7f1b4f0.trailing (active)>", "<NSLayoutConstraint:0x600003caf980 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x7fe5d7f1b4f0.width == 0 (active)>", "<NSLayoutConstraint:0x600003cb35c0 'UIView-leftMargin-guide-constraint' H:|-(8)-UILayoutGuide:0x60000269d260'UIViewLayoutMarginsGuide' (active, names: '|':_UINavigationBarContentView:0x7fe5d7f1b4f0 )>" )

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x600003cac7d0 UIView:0x7fe5d7f259e0.trailing == _UIBackButtonMaskView:0x7fe5d7f15ef0.trailing (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful. 2022-08-28 18:59:14.094256-0600 iExpense[70171:2025976] [LayoutConstraints] 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:0x600003cad310 'BIB_Trailing_CB_Leading' H:[_UIModernBarButton:0x7fe5d7f20890]-(6)-[_UIModernBarButton:0x7fe5d7f1d9e0'Best App Ever'] (active)>", "<NSLayoutConstraint:0x600003cad360 'CB_Trailing_Trailing' _UIModernBarButton:0x7fe5d7f1d9e0'Best App Ever'.trailing <= _UIButtonBarButton:0x7fe5d7f1cec0.trailing (active)>", "<NSLayoutConstraint:0x600003cae030 'UINav_static_button_horiz_position' _UIModernBarButton:0x7fe5d7f20890.leading == UILayoutGuide:0x60000269d260'UIViewLayoutMarginsGuide'.leading (active)>", "<NSLayoutConstraint:0x600003cae080 'UINavItemContentGuide-leading' H:[_UIButtonBarButton:0x7fe5d7f1cec0]-(6)-[UILayoutGuide:0x60000269d180'UINavigationBarItemContentLayoutGuide'] (active)>", "<NSLayoutConstraint:0x600003cb32a0 'UINavItemContentGuide-trailing' UILayoutGuide:0x60000269d180'UINavigationBarItemContentLayoutGuide'.trailing == _UINavigationBarContentView:0x7fe5d7f1b4f0.trailing (active)>", "<NSLayoutConstraint:0x600003caf980 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x7fe5d7f1b4f0.width == 0 (active)>", "<NSLayoutConstraint:0x600003cb35c0 'UIView-leftMargin-guide-constraint' H:|-(8)-UILayoutGuide:0x60000269d260'UIViewLayoutMarginsGuide' (active, names: '|':_UINavigationBarContentView:0x7fe5d7f1b4f0 )>" )

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x600003cad310 'BIB_Trailing_CB_Leading' H:[_UIModernBarButton:0x7fe5d7f20890]-(6)-[_UIModernBarButton:0x7fe5d7f1d9e0'Best App Ever'] (active)>

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

1      

@Bnerd  

it seems adding .navigationViewStyle(StackNavigationViewStyle()) to the NavigationView solves the issue.

NavigationView {
                Text("Hello, world!")
                  .navigationTitle("Best App Ever")
              }.navigationViewStyle(StackNavigationViewStyle())

I don't know why exactly it works, source: https://stackoverflow.com/questions/65316497/swiftui-navigationview-navigationbartitle-layoutconstraints-issue

2      

Thanks. It looks like that will solve my problem for now. But, it seems that there is some argument about whether or not that is the best way to actually fix the problem.

1      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.