Warning frame for "Navigation bar" will be different at run time appears in Xcode 8 Swift 3

23,755

Solution 1

Warning will disappear if you change the property "Simulated Size" to "Freeform".

Solution 2

As mentioned here you can fix this by toggling Adjust Scrollview Insets on/off.

Solution 3

I have changed from View as: iPhone 6S to iPhone 5S, then changed back to iPhone 6S, and Xcode did all the changes to remove the warning.

Solution 4

This worked for me at Xcode 8.3.1 After restarting Xcode, it would still work.

enter image description here

  1. Select Navigation Controller

enter image description here

  1. Go to Show the Size Inspector

enter image description here

  1. Change Simulated Size to Freeform

enter image description here

  1. Change Simulated Size back to Fixed

enter image description here

  1. Then the warnings disappear.

enter image description here

Solution 5

As a workaround just to get rid of the annoying warning I have been editing Main.storyboard manually by removing 'misplaced' in:

<navigationBar key="navigationBar" opaque="NO" contentMode="scaleToFill" misplaced="YES" translucent="NO" id="Os1-Xh-7XN">

A hack but it is nice to have zero warnings rather than 1 :)

Share:
23,755
Danny
Author by

Danny

Updated on July 08, 2022

Comments

  • Danny
    Danny almost 2 years

    Before I've upgraded to Xcode 8 I haven't seen this error in such case. I have different Navigation Controllers. For all of them I see an error Frame for "Navigation bar" will be different at the run time. Navigation bar "Expected: width=384, Actual: width=375. In reality these Navigation Controllers doesn't have Navigation bar. Navigation bar exists for subviews. Anyway I could solve it by tick and untick the checkbox Shows navigation bar in Attributes inspector. But unfortunately every time I reopen Main.storyboard this warning appears again. Also if I click on yellow triangle and then on update frames nothing happen.

    enter image description here

  • Danny
    Danny over 7 years
    After reopening of XCode this warning actually disappears, but if I open any file in the project an the again open main.storyboard these warnings appear again
  • Ashish Kakkad
    Ashish Kakkad over 7 years
    This doesn't solve problem. Close Xcode and Open again the issue will come again.
  • AlessandroDP
    AlessandroDP over 7 years
    @AshishKakkad And there is! Used to do the same and become normal, but then again it's a warning there...
  • nekonari
    nekonari over 7 years
    This is bugging the hell out of me.. I just tried this, and this does remove warning temporarily. You can always switch Simulated Size back and forth to remove the warning when it does come back. Super. Annoying.
  • zero3nna
    zero3nna over 7 years
    it also just temp fixing it for me
  • Sethmr
    Sethmr over 7 years
    Will I have to add this back later? I don't really care what my navigation Controller looks like so long as I don't have warnings. It's kind of funny. The storyboard recognizes the warning for a split second and then it goes away when you enter the storyboard this way.
  • Abdul Waheed
    Abdul Waheed over 7 years
    I am USING SE .. but still Warning
  • nekonari
    nekonari over 7 years
    Yeah, I know. But they do go away whenever you switch that selection to something else. Nowadays, I start with 7, switch to SE, then back to 7 to clear these warnings. Or just leave them, and just not check misplaced properties in when commiting changes.
  • buildsucceeded
    buildsucceeded over 7 years
    Wow, and (checking git) literally all that happens when you do this is that misplaced="YES" gets removed. :/
  • emem
    emem over 7 years
    Only a temporary fix - this is not the answer.
  • Micah Montoya
    Micah Montoya over 7 years
    You may still see this error if you don't manually change the size to the suggested.
  • Casey Wagner
    Casey Wagner over 7 years
    That fixes it until the next time your close and reopen the project. Not a complete fix.
  • nodyor90z
    nodyor90z over 7 years
    Solved my problem. Thanks @Kai
  • bauerMusic
    bauerMusic over 7 years
    Either change this Simulated Size (and back to 'Inferred' or whatever) or "toggling Adjust Scrollview Insets on/off". Both will cause Storyboard to remove its misplaced="YES". This is an Xcode bug, and this fix is a force-refresh kind. Taken from @buildsucceeded answer.
  • Zhao
    Zhao over 7 years
    I did the same thing and then don't touch the storyboard again. Everything works well.
  • Slipp D. Thompson
    Slipp D. Thompson about 7 years
    Does not work in this situation. The X/Y/Width/Height fields for the Navigation Bar are all grayed-out/uneditable.
  • Slipp D. Thompson
    Slipp D. Thompson about 7 years
    @Ian Hmmm… I think I just ended up editing the xib so that the numbers matched up.
  • UKDataGeek
    UKDataGeek about 7 years
    @bauerMusic what do you mean a force refresh kind?
  • bauerMusic
    bauerMusic about 7 years
    @MobileBloke By force-refresh I meant that it will cause the Storyboard view to rewrite (refresh) the params, re-evaluate and remove the warning. It's really a refresh, force was only meant that it didn't do it automatically by itself (as it should) and needed some manual arbitrary change.
  • UKDataGeek
    UKDataGeek about 7 years
    Makes sense - I thought there was a magic button . I noticed that storyboard is taking longer to load since this bug started appearing .. you seeing this too ?
  • UKDataGeek
    UKDataGeek about 7 years
    PRoblem is that when you reload it comes back... anyone else noticing that it takes a long time to load the storyboard with the spinner running when this error occurs?
  • UKDataGeek
    UKDataGeek about 7 years
    This worked for a short time- then after Xcode procesed it again - the same thing happened and the warning re-occured. Is this still working for you on latest Xcode?
  • thetrutz
    thetrutz almost 7 years
    You only need to set it only on the view controllers that have no parents (root view controller + maybe more, depending on what you have in your storyboard)
  • Duck
    Duck over 6 years
    Xcode is a sea of unsolved bugs that continue there, marinating, forever.
  • Efren
    Efren over 6 years
    I could only make it go away permanently (even after restart) by using the width that appeared in the warning, as the value in the Freeform option.
  • Manganese
    Manganese over 6 years
    Any idea why this would have worked and not "Update frames" button?
  • May Phyu
    May Phyu over 6 years
    @guoc, bro could you help me please stackoverflow.com/questions/46375778/… ?