Finding cause of “Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0”
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.
- Move Tab Bar to top of screen
- How to disable “Relative to margin” option for newly created constraint in Xcode6
- how to put constraints on views in interface builder to satisfy all iphone Screen in Xcode 8
- Nested UIStackViews Broken Constraints
- iPhone: Create a reusable component (control) that has some Interface Builder pieces and some code
- Images for retina display iphone
8 Solutions Collect From Internet About “Finding cause of “Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0””
Here is one way to find the specific label that is causing this warning:
- Right click on the warning and choose “Reveal in Log”
- The warning in the log will be highlighted. Copy the interface builder object ID for this label (it looks like xxx-xx-xxx).
- Paste this in the Find Navigator. When you click on this result it will open the interface builder with the offending label selected.
Running XCODE 6.1, I found the easiest way to do find the error was through the Report Navigator.
Show Report Navigatoror simply press
- Click on the build in the left pane.
- Click the details icon next to the warning.
- Find the object id in the warning description.
- Go to the file and search
⌘-ffor the object id.
- Fix the issue. Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
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
just remove number of line from label and set it programmatically
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.
- Encoding UIImage to Base64 string not working when transferred to server
- background image also scroll while scroll content in UISCROLLVIEW
- UISplitViewController: remove divider line
- record input coming from bluetooth headset in iPhone
- Testing for equality in Realm
- Passing data between UITableViewCell and UITableViewController?
- How to move a view along a curved path in iOS
- Sprite Kit – Add random Sprite Nodes to the scene with Switch Case
- Read a text file line by line in Swift?
- How to update Xcode 3.2.5 to 4.4.1 version in mac leopard?
- Sound resource can not be loaded Swift SKAction
- Creating a Countdown Watch with a slider in Xcode
- how to check if the iOS device is locked/unlocked using Swift?
- Status Bar in UITableViewController
- Facebook is not shown in UIActivityViewController but twitter does