Finding cause of “Automatic Preferred Max Layout W

2019-03-18 08:20发布

I know the reason of this warning and how to solve it: to give a preffered width to the label.

The problem is that, when I click that warning, I don't see any label/view/viewcontroller selected. The storyboard opens and that's it. There are many view controllers with many views in my storyboard. How can I find out which label is causing the problem without iterating through all the view controllers manually? When I click the warning, I expect it to take me to the view causing the warning, but it just opens the storyboard.

8条回答
乱世女痞
2楼-- · 2019-03-18 08:52

Running XCODE 6.1, I found the easiest way to do find the error was through the Report Navigator.

  1. View -> Navigators -> Show Report Navigator or simply press ⌘-8
  2. Click on the build in the left pane.
  3. Click the details icon next to the warning.

enter image description here

  1. Find the object id in the warning description.

enter image description here

  1. Go to the file and search ⌘-f for the object id.

enter image description here

  1. Fix the issue. Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
查看更多
姐就是有狂的资本
3楼-- · 2019-03-18 08:59

I must switch to XCode 6.2 --> click on warning icon at top right of the main XCode area --> choose the warning --> it shows exactly the item that cause the warning. enter image description here

查看更多
登录 后发表回答