Close app on Swift

Asked

Viewed 139 times

3

I am starting in Swift programming and my question is how to close the application. For example, on android, used the System.exit(0) has something like me Swift?

  • 1

    Forget this Flavio approach. Choose a screen that makes the application inoperative and inform the user about what is happening. Even on Android, in terms of usability for the user, this operation should not be performed.

  • thanks Dasilva for the reply. Yes I am removing this option from the app development.

1 answer

4

There are several ways to finish the application on Swift, for example: exit(0), abort(), assert(false)

However, this goes against the guidelines from Apple and will cause the app to be rejected in the App Store. There is no API indicated to terminate an iOS app. The user decides when to close the app. Use this method only during development or for debugging.

  • 1

    Thanks Rafael for the tip about I will follow to not be rejected in the App Store

Browser other questions tagged

You are not signed in. Login or sign up in order to post.