Xcode 9 - Localization Issue Warning Storyboard

Xcode 9 - Localization Issue Warning Storyboard

The source of the unwanted warnings is that Xcode defaults to having storyboards "prepared" for localization. They are "prepared" by setting them up using base internationalization.

To completely disable this warning in a particular storyboard, you need to let Xcode know that the storyboard should not be considered localizable. The easiest way I was able to do this was to simply move the storyboard file from the Base.lproj folder up one level and re-add the file to the project. Once I did that, the warnings went away.

Steps

This process should work with old and new projects. Tested on Xcode 9.1 using a project created with Xcode 9.1

  1. Move the storyboard from the Base.lproj folder up one level via Finder
  2. Delete the storyboard reference from your project via Xcode
  3. Drag and drop (or otherwise re-add) the storyboard to your project
  4. Verify using the File Inspector that the storyboard no longer has base localization

 
 
 

Pictorial Walkthrough

Xcode defaults to having storyboards "prepared" for localization

Xcode default storyboard folder structure

 
 
 

Move your storyboard files out of the Base.lproj folder to prevent the warnings

Desired folder structure

 
 
 

Delete the file reference

Delete the file reference

 
 
 

Re-add the storyboard

Drag and drop the file back into the project
Sample Image

 
 
 

You'll see the "Localize..." button when you've succeeded

Yay! No more warnings

 
 
 

If you want to localize in the future

Just tap the "Localize..." button and follow the prompts from Xcode. Additionally, you'll actually need to address the warnings that Xcode is telling you about. There are various ways to address them, I recommend this question to get started.

For a video demonstration of the process, watch this screen recording

Xcode 9 - Fixed Width Constraints May Cause Clipping and Other Localization Warnings

I was getting the same warnings even without multiple languages in my app, which led me to find out what was really going on. . .

There are a few different things going on here. I was able to silence the fixed-width warnings in my own app by changing the width of the object spacings from fixed width to greater than or equal or less than or equal.

This can be done by selecting the object in interface builder, going to the size inspector and changing it there:

Sample Image


Or, select the constraint from the document outline, go to size inspector, and change it there:

Sample Image



As far as the warning at the top of your screenshot:

Fixed leading and trailing constraints with a center constraint may
cause clipping

Here is a screenshot from my own app in which I was getting the exact same warning:

Sample Image

I had the label with the @ sign set to leading and trailing to the buttons but also to align the center with the rating label. Once I removed the center alignment constraint, the warning disappeared, but I was left with an improperly laid out set of objects.

It is then that I resigned myself to embrace the Stack View. As annoying as it is to use, when you get all of the constraints and settings right, it lays out beautifully and with no warnings.


Edit

As Repose writes in the comments, sometimes simply adding >= 0 will be what you need, as you are making sure two elements do not overlap.

How to resolve the Storyboard's warnings on Xcode?

  • Give Trailing to Hello, Label with World! label like below image give Constant 8 (What minimum gap you need) to Trailing constraint and change Relation to Grater than or Equal.

Sample Image



Related Topics



Leave a reply



Submit