TIP - Check ambiguous layout in Xcode debugger

How can I check auto layout issue of iOS application from Xcode? Easy.

  1. Run your application
  2. Pause by debugger
  3. Type the following command from debug console:
(lldb) po [[UIWindow keyWindow] _autolayoutTrace]

You can see the trace from debug console such as:

*<UIWindow:0x9980df0>
|   *<UIView:0x8eb2fd0>
|   |   *<UISwitch:0x8eb31b0>
|   |   |   <_UISwitchInternalViewNeueStyle1:0x8eb3540>
|   |   |   |   <UIView:0x8eb3ac0>
|   |   |   |   |   <UIView:0x8eb3840>
|   |   |   |   <UIView:0x8eb3a10>
|   |   |   |   |   <UIView:0x8eb38f0>
|   |   |   |   <UIImageView:0x8eb3da0>
|   |   *<UISlider:0x8eb61d0> - AMBIGUOUS LAYOUT
|   |   |   <UIView:0x8eb9290>
|   |   |   |   <UIView:0x8eb9af0>
|   |   |   |   |   <UIView:0x8eb9bc0>
|   |   |   |   <UIView:0x8eba490>
|   |   |   <UIImageView:0x8eba6a0>
|   |   |   |   <UIImageView:0x8eba540>

If you think type this long command is too tedious, please try to use alias. Check about my blog article for LLDB usage.

Please see the following WWDC 2012 sessions to understand more about auto layout.

댓글

이 블로그의 인기 게시물

Wireless: HotSpot 2.0 이란?

Apple M1 Mac Mini에서 이더리움 (Ethereum) 채굴하기

Java: Java for Game? Java가 Game 개발에 어울릴까?