본문 바로가기

iOS/STUDY

[iOS] 레이아웃이 깨졌을 때 콘솔창 버그

ㅋ2022-04-26 13:03:40.451472+0900 DoGit[4494:107137] [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:0x6000023de9e0 UIView:0x13fd292b0.bottom == UIView:0x140f76c30.bottom   (active)>",

    "<NSLayoutConstraint:0x6000023de8f0 UIView:0x13fd292b0.top == UILayoutGuide:0x600003e14d20'UIViewSafeAreaLayoutGuide'.top + 844   (active)>",

    "<NSLayoutConstraint:0x6000023de760 'UIView-Encapsulated-Layout-Height' UIView:0x140f76c30.height == 844   (active)>",

    "<NSLayoutConstraint:0x6000023de580 'UIViewSafeAreaLayoutGuide-top' V:|-(47)-[UILayoutGuide:0x600003e14d20'UIViewSafeAreaLayoutGuide']   (active, names: '|':UIView:0x140f76c30 )>"

)

Will attempt to recover by breaking constraint 

<NSLayoutConstraint:0x6000023de9e0 UIView:0x13fd292b0.bottom == UIView:0x140f76c30.bottom   (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.

 

레이아웃이 깨진 것 같으니 symbolic breakpoint (UIViewAlertForUnsatisfiableConstraints) 를 만들어서 디버깅해봐라라는 메세지를 담고 있는 것을 알 수 있습니다.

 

symbolic breakpoint 만드는 법

디버깅 창에서 + 를 눌러서 Symbolic Breadkpoint를 생성합니다.

 

Symbol 부분에 UIViewAlertForUnsatisfiableConstraints 를 적어줍니다.

 

프로젝트를 다시 실행하고 콘솔창에 에러가 발생한 화면으로 가면 오류가 발생한 지점에서 멈추게 됩니다.

 

 

View Process by Thread을 선택하여 스레드 call stack을 확인하면 됩니다.

 

아래 -> 위 순서가 실행된 순서입니다.

 

 

콘솔창 메세지로 확인하는 방법

    "<NSLayoutConstraint:0x6000023de9e0 UIView:0x13fd292b0.bottom == UIView:0x140f76c30.bottom   (active)>",

    "<NSLayoutConstraint:0x6000023de8f0 UIView:0x13fd292b0.top == UILayoutGuide:0x600003e14d20'UIViewSafeAreaLayoutGuide'.top + 844   (active)>",

    "<NSLayoutConstraint:0x6000023de760 'UIView-Encapsulated-Layout-Height' UIView:0x140f76c30.height == 844   (active)>",

    "<NSLayoutConstraint:0x6000023de580 'UIViewSafeAreaLayoutGuide-top' V:|-(47)-[UILayoutGuide:0x600003e14d20'UIViewSafeAreaLayoutGuide']   (active, names: '|':UIView:0x140f76c30 )>"

 

이 메세지를 여기 사이트에 입력하면 어떤 조건인지 알려줍니다.

 

https://www.wtfautolayout.com/

 

WTF Auto Layout?

Make sense of cryptic Auto Layout error logs.

www.wtfautolayout.com

 

이런식!

 

 

 

 

 

+) UI 계층 보기.. 신기