title: iOS How to restart app for changing language Swift 4
body: <p>I work with multi language app, i want to change language manually in profile user.</p>
  
  <p>I already have Localization.string</p>
  
  <p>And if i change device language, language in app changin to.</p>
  
  <p>But i want to change language manually from user profile example:</p>
  
  <p><a href="https://i.stack.imgur.com/SmWjB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SmWjB.png" alt="enter image description here"></a></p>
  
  <p>And for this i use next code:</p>
  
  <pre><code>private func changeToLanguage(_ langCode: String) {
      if Bundle.main.preferredLocalizations.first != langCode {
          let message = "In order to change the language, the App must be closed and reopened by you."
          let confirmAlertCtrl = UIAlertController(title: "App restart required", message: message, preferredStyle: .alert)
  
          let confirmAction = UIAlertAction(title: "Close now", style: .destructive) { _ in
              UserDefaults.standard.set([langCode], forKey: "AppleLanguages")
              UserDefaults.standard.synchronize()
              exit(EXIT_SUCCESS)
          }
          confirmAlertCtrl.addAction(confirmAction)
  
          let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
          confirmAlertCtrl.addAction(cancelAction)
  
          present(confirmAlertCtrl, animated: true, completion: nil)
      }
      UserDefaults.standard.set([langCode], forKey: "AppleLanguages")
      UserDefaults.standard.synchronize()
  }
  
  
  
    @IBAction func didPressChangeLanguageButton() {
      let message = "Change language of this app including its content."
      let sheetCtrl = UIAlertController(title: "Choose language", message: message, preferredStyle: .actionSheet)
  
      for languageCode in Bundle.main.localizations.filter({ $0 != "Base" }) {
          let langName = Locale.current.localizedString(forLanguageCode: languageCode)
          let action = UIAlertAction(title: langName, style: .default) { _ in
              self.changeToLanguage(languageCode) // see step #2
          }
          sheetCtrl.addAction(action)
      }
  
      let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
      sheetCtrl.addAction(cancelAction)
  
      sheetCtrl.popoverPresentationController?.sourceView = self.view
      sheetCtrl.popoverPresentationController?.sourceRect = self.changeLanguageButton.frame
      present(sheetCtrl, animated: true, completion: nil)
  }
  </code></pre>
  
  <p>And i use this bundle:</p>
  
  <pre><code>Bundle.main.localizations.filter({ $0 != "Base" })
  Locale.current.localizedString(forLanguageCode: "en")
  </code></pre>
  
  <p>For this code i have:</p>
  
  <p><a href="https://i.stack.imgur.com/t1lov.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t1lov.png" alt="enter image description here"></a></p>
  
  <p>And when i press the button i get error:</p>
  
  <blockquote>
    <p>reason: 'Actions added to UIAlertController must have a title'</p>
  </blockquote>
  
  <p>I have no idea where the problem.</p>