title: Set default language before the app starts for the first time in iOS/Swift
body: <p>I wanna set another language as default when the app starts for the first time. iOS doesn't not have this language as an interface language, so my only way is to set it manually. I've found dozens of solutions on SO, and those that work, ONLY work in simulator and not on a real device. Here's what I've tried:</p>
  
  <p>First of all, the way to set the app's language is:</p>
  
  <pre><code>UserDefaults.standard.set(["xx-XX", "yy-YY"], forKey: "AppleLanguages")
  </code></pre>
  
  <p>The thing is, that this needs the app to be restarted, while <strong>I want it to be set the first time the app starts</strong>. I've also tried:</p>
  
  <pre><code>UserDefaults.standard.register(defaults: ["AppleLanguages": ["xx-XX", "yy-YY"]])
  </code></pre>
  
  <p>and even calling <code>UserDefaults.standard.synchronize()</code> which in most cases is not needed at all.</p>
  
  <p>And the places I've tried putting this code:</p>
  
  <ol>
  <li>application(:didFinishLaunchingWithOptions:)</li>
  <li>application init :|</li>
  <li>Subclassing <code>UIApplication</code>, creating <code>main.swift</code> and adding the
  above codes as top level statements</li>
  </ol>
  
  <p>And in <code>info.plist</code>:</p>
  
  <ol>
  <li>Setting <code>Localization native development region</code> to <code>xx-XX</code></li>
  <li>Setting the first element of <code>Localizations</code> to <code>xx-XX</code></li>
  </ol>
  
  <p>By the way, implementing custom localization is not an option at this point in time. </p>
  
  <p>And what confuses me the most, is why such a feature works in simulator and not a real device.</p>
  
  <p><strong>EDIT:</strong>
  I even deleted the default english language, and adding <code>English (World)</code> again, so that there was no <code>Development Language</code> label beside it. Still didn't work.</p>