You should not terminate the app as it lead to rejection by apple.As docs say

There is no API provided for gracefully terminating an iOS application.

You can show pop up to user for appropriate message.During development or testing you can call abort().But you should not ship your app with any of terminate api as apple strongly discourage this.

More Answer related to the Same Query


you can try exit(0); but Let me warn you apple may reject your app if you terminate your app willingly, what would be better is to show a dialogue box containing the reason and asking the user to close the app on thier own.


You really should not terminate your application, but should prompt the user that there's nothing to show at the moment and have them go to the home screen.

However, if you really want to, you can use abort().

From Apple's Developer Library (emphasis added):

In iOS, the user presses the Home button to close applications. Should your application have conditions in which it cannot provide its intended function, the recommended approach is to display an alert for the user that indicates the nature of the problem and possible actions the user could take — turning on WiFi, enabling Location Services, etc. Allow the user to terminate the application at their own discretion. [...]

If during development or testing it is necessary to terminate your application, the abort function, or assert macro is recommended.

Credit Goes to: stackoverflow.com

Related question with same questions but different answers