Quit iPhone app programmatically

Hello,

MyApp asks a user to do a job on his iPhone. After user has finished this job, data user has produced are uploaded to iCloud. Thereafter MyApp should be quitted. I do the following:

	DispatchQueue.main.async
		{
			self.credentialView.removeFromSuperview()
		}
	exit(EXIT_SUCCESS)

This seems to work. No Error message. Unfortunately, the data user produces cannot be queried on iCloud. Data seem to be inexistent.

But, if I do the following:

	DispatchQueue.main.async
		{
			self.credentialView.removeFromSuperview()
		}
	// exit(EXIT_SUCCESS)

Now user's data can be queried on iCloud. But MyApp does NOT quit. The superview is still present. MyApp should be quitted to prevent user from doing impermissible operations. How can I quit MyApp programmatically?

Best regards Gerhard

Quit iPhone app programmatically
 
 
Q