0

I'm allowing language change feature inside my application. As user select new language feature inside the application I need to quit the application and user will have to start it again. For quitting I'll show an alert to user that you have to restart the application for language change to complete.

Now how can I use manual termination of iOS app and make it approve from Apple.

PS: Facebook do the same for language change. They tell the user that app needs to restart for language change to take place. Some other apps also kills the application on some alert tap.

Rohitax Rajguru
  • 893
  • 2
  • 13
  • 35
  • Kindly please check this : https://medium.com/if-let-swift-programming/working-with-localization-in-swift-4a87f0d393a4 You can change language without restarting application. – Nirav Jul 19 '19 at 10:30

2 Answers2

2

exit(0)

you can solve your problem by this, but this is forbidden by Apple. You should set your app to your Home page when you change your language.

let viewController = HomeViewController()
UIApplication.shared.keyWindow.rootViewController = viewController
Ankur Lahiry
  • 2,253
  • 1
  • 15
  • 25
1

Ankur gave you the correct answer: You can use exit to terminate your app but Apple does not allow apps to terminate themselves. Your app will be rejected from the app store if you do that.

Instead, you should refactor your app so you have the ability to tear down your entire UI and rebuild it. Delete all your view controllers and replace the root view controller as Ankur says.

Duncan C
  • 128,072
  • 22
  • 173
  • 272