Swift How to get out of the application

1

Basically that, how can I close the application since I can not find almost any information about it and I would like to add that function to a button in the navigation controller so that the user leaves the application whenever they want, I have seen that they talk about the exit ( ) but they do not recommend it because this is understood as a crash.

    
asked by elkin sepulveda 13.08.2016 в 14:36
source

2 answers

0

In iOS the application should never be closed using exit() or similar. Simply, the Home button of iPhone is for that. It is a very bad practice to close the application programmatically.

    
answered by 13.08.2016 / 14:38
source
0

Your question is about Swift, how to get the application to exit programmatically, there is NOT an API officially to do it, but a way to achieve it is similar to iOS applications, it can be done by executing the method:

exit(0);

It is important to read the documentation on the use of this method:

link

  

Attention : Do not call the exit () function. Applications that use this   method can register the user who had an error. Instead of   perform an elegant termination and animation to the screen   home.

    
answered by 13.08.2016 в 21:32