Finding cause of “Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0”

你说的曾经没有我的故事 提交于 2019-12-03 06:19:58

Here is one way to find the specific label that is causing this warning:

  1. Right click on the warning and choose "Reveal in Log"
  2. The warning in the log will be highlighted. Copy the interface builder object ID for this label (it looks like xxx-xx-xxx).
  3. Paste this in the Find Navigator. When you click on this result it will open the interface builder with the offending label selected.
Tom Howard

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.

  1. Find the object id in the warning description.

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

  1. Fix the issue. Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
Romain TAILLANDIER

As said in that post, you can also use this regex <label(?!.*preferredMaxLayoutWidth) in storyboard source to find all labels that do not have a preferredMaxLayoutWidth setted. Then correct it.

Answer of @Don Eichenseer is great. But for those who want to solve it: I've got the same problem before. The issue was because of a UILabel which its Lines property (in Attributes inspector) was more than 1. When you have found the related UILabel, set it Lines to 1.

just remove number of line from label and set it programmatically

[label setNumberOfLines:2];

Is that the warning from a collection view? If so I'd guess it's a cell and a label with number of lines set to zero.

I had the same problem in an existing project developed in 7.1 without autolayouts. Once I migrated the app to iOS8 and changed in the project file the version to 8.0, for some reason I got that warning in the Xib's where I used UILabel's with multiple lines.

in order to correct the problem, select the file inspector for the Xib and check the version it Builds for, in my case it was still for iOS7

you should change the Build for to the relevant version

and the warning will disappear as it did in my case :-)

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!