0

I am a newbee in iOS app development, and trying to create a small app using Xcode. One of my views has button to close the app. When a user taps this button, then I have to redirect the user to the "launch screen".

But don't know how. Can anybody guide me?

Thanks

Tobi Nary
  • 4,566
  • 4
  • 30
  • 50
Manish Sapkal
  • 5,591
  • 8
  • 45
  • 74
  • 2
    If you close your app on a button action then apple may reject your app. Launcher screen i.e. appears only at 1st but if you want to show it some other time then you need to use a separate view. – Reshmi Majumder Jan 27 '16 at 09:42
  • @ReshmiMajumder, What do you mean by "App. Launcher Screen". I am looking for a device Launcher Screen, not for a "splash screen". Thanks – Manish Sapkal Jan 27 '16 at 10:20
  • Possibly a duplicate of [Is there any way to programatically send my iPhone app to the background](http://stackoverflow.com/questions/13989030/is-there-any-way-to-programatically-send-my-iphone-app-to-the-background) – Cristik Jan 28 '16 at 08:10

2 Answers2

0

First of all there is no way you can 'close' an app programmatically. The alternative solution is to force crash the app using the exit function.

you can use the code below:

exit(0);
Tobi Nary
  • 4,566
  • 4
  • 30
  • 50
Crazy Developer
  • 3,464
  • 3
  • 28
  • 62
0

Apple strongly discourages you to programmatically quit an iOS application. The standard way to move back to (redirect to) the Launcher screen (which by the way is Home screen for iOS) is when the user presses the Home button.

Calling exit(0), will not invoke the UIApplicationDelegate methods such as applicationWillTerminate: etc., and thus should not be used in general.

Reference of the Same can be found in Apple's Technical Q&A QA1561

UditS
  • 1,936
  • 17
  • 37