30

I am getting constraint warnings for my Navigation Bar's for each of my Navigation Controllers in each of my storyboards in Xcode 8.

Screenshot of warning

To get rid of the warning I set the Navigation Controller's Simulated Metrics->Top Bar setting from Inferred to None and then back again, and the warning goes away. Until the next time the storyboard is opened, then the warnings come back.

My storyboard has the iPhone SE display setting, and the navigation bar's are not Translucent.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
jakedunc
  • 984
  • 9
  • 20
  • Are you opening your project by selecting the project (.xcodeproj) or workspace (.xcworkspace)? I have been trying to debug the same problem all day and am seeing different behavior depending on if I open the project or the workspace. – nurider Sep 19 '16 at 00:16
  • I use cocoapods so .xcworkspace, after you have any cocoapods installed you should only use the workspace file.. – jakedunc Sep 19 '16 at 11:56
  • I use cocoapods as well and have the same error. However, if I open the project (.xcodeproj) instead of the workspace (.xcworkspace) the errors go away. I don't know exactly what it causing this but just wanted to see if this happens for you as well. If you open the project instead of the workspace do your errors go away? – nurider Sep 19 '16 at 14:58
  • did you ever resolve this? I'm still having the problem and it's erratic. – nurider Nov 22 '16 at 19:22

3 Answers3

26

Changing the device preview from iPhone SE also removes the warning.

Xcode 8 has some serious bugs in Interface Builder: as well as this one, it has a nasty habit of random-seeming frame changes to all sorts of views - in my Main.storyboard, it decided to make some keyboard input accessory views 1,000 by 1,000 points, and everything inside it had a frame of {0,0} - {1000,1000}.

Did the same thing to various UITableViewCells, but not all of them.

Changing everything back took ages, cleaned the build folder and recompiled, but the problem came back straight away as soon as the storyboard was opened.

I had to uninstall 8 and go back to 7.3.1, I filed a radar, saw other people with the same problem on the dev forums.

IanW
  • 456
  • 3
  • 9
  • Can you please share the link to the Dev forums. I've been having the same issue and I really want to get past it but Apple is taking a long time to get back to me. What they suggested (simply do the hugging priority on the view controllers with problems) doesn't seem to be any sort of fix/workaround. – Mario A Guzman Sep 16 '16 at 01:43
  • 5
    Here's the link to the main issue: https://forums.developer.apple.com/thread/62313 There isn't a workaround or fix that is even slightly reliable or useful at the moment. It's just another example of Apple's software quality falling off a cliff for the sake of deadlines. – IanW Sep 16 '16 at 12:45
  • I got the 1000 x 1000 elements after upgrading to xcode 8. I have a cell prototype where the cell height is based on the cell content - the combined Y constraints give you the cell height. Once I removed the very bottom Y constraint and did update frame for each element things came back to normal size/location. At the end I re-added the bottom Y constraint. – Pawel Jasinski Sep 19 '16 at 15:04
  • Had the same 1,000x1,000 issue with subclassed `UIButton`s when referencing `frame` within `init?(coder aDecoder: NSCoder)`. The width and height were always 1,000. The solution was to move the calculations to `override func layoutSubviews()`. – Scott D. Strader Sep 29 '16 at 20:58
  • I tried a number of things like these to fix it; no matter what I did, the problem kept coming back and at one point it got so that even when the storyboard was fixed, running the app would be broken anyway. I filed a radar, and it got closed yesterday as a duplicate that's still open. – IanW Sep 30 '16 at 10:49
  • 1
    Just to clarify for people who did not (yet) dive into the apple dev forum link IanW provided (https://forums.developer.apple.com/thread/62313). This is definitely a big in Xcode (so you probably didn't do anything wrong, rather the IDE messes up). At least the (0,0,1000,1000) frame bug is fixed as of Xcode 8.1 beta 2. I had both (the Nav bar thing and that frame mess) and almost ripped my hair out trying to find where I made a mistake that lead to the updated Storyboard being wrong. I haven't... So thanks for the link, IanW. – Gero Oct 21 '16 at 06:52
  • @Gero is correct, Xcode 8.1 beta 2 did fix my particular problems with the (0,0)-(1000,1000) frame resizing. I can confirm the the 8.1 GM Seed now seems to be usable in this regard, although the various bar heights are still incorrect in Landscape mode, and the Navigation Bar still generates a warning when using the iPhone SE device preview setting. Weirdly, IB switches to an iPhone 7 device preview the first time you open storyboards in the GM seed; I had to go through and reset everything to fix all the now-overlapping views. – IanW Oct 27 '16 at 10:13
  • 1
    For some reason, changing to iPhone SE removed the warning, then I changed back to iPhone 7 and the warning stayed gone. – Simon Germain Jan 12 '17 at 01:29
  • @SimonGermain, awesome trick! Worked for me too. – kpower Jun 13 '17 at 00:09
6

I encountered with the same problem. I am not sure that is solution or not but I just changed the Simulated Metrics size which is page size from freeform to the Page Sheet and warning dissappeard

Yigit Alp Ciray
  • 163
  • 1
  • 7
0

Regarding the issues of Xcode automatically moving some views/subviews to {0, 0, 1000, 1000} frame bug, which is related to main question:

I had the same problem. Make sure to use Xcode 8.1 now as this problem is fixed in that version.

Xcode 8.1 Release notes https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html

Radars related : 28221021, 28244619

Update - Pointing the explicit frame bug solved on Xcode 8.1

CoderPug
  • 908
  • 9
  • 19