0

I want to send my Application to background simply clicking on Button inside my Application. Is there any way to call applicationdidenterbackground manually or any other way ?

sergio
  • 68,819
  • 11
  • 102
  • 123
jaym
  • 1,253
  • 13
  • 18

2 Answers2

4

iOS Human Interface Guidelines says "Don't Quit Programmatically", whereby quitting must be understood as including "suspending":

Never quit an iOS application programmatically because people tend to interpret this as a crash. However, if external circumstances prevent your application from functioning as intended, you need to tell your users about the situation and explain what they can do about it. Depending on how severe the application malfunction is, you have two choices.

Display an attractive screen that describes the problem and suggests a correction. A screen provides feedback that reassures users that there’s nothing wrong with your application. It puts users in control, letting them decide whether they want to take corrective action and continue using your application or press the Home button and open a different application

If only some of your application's features are not working, display either a screen or an alert when people activate the feature. Display the alert only when people try to access the feature that isn’t functioning.

If you really want to exit your app programmatically, then you can call exit(0);, but I doubt that you app will pass the Apple review.

Community
  • 1
  • 1
sergio
  • 68,819
  • 11
  • 102
  • 123
  • if you hide well enough button for exit(0) it will pass the review :) – alinoz Jun 11 '12 at 13:57
  • Your app will most definitely be rejected if you use `exit(0)`. In addition, doing this completely breaks the multitasking switcher behaviour. – Mike Weller Jun 11 '12 at 13:57
  • @MikeWeller how will they find if you have a secret exit(0)? – alinoz Jun 11 '12 at 14:43
  • @alinoz: But it is a breach of contract if Apple finds out, since you are required to disclose hidden features (e.g. "easter eggs") to the App Review team. – tc. Jun 11 '12 at 16:06
  • @tc: what you can do if your customer is pushing that "feature"? For some people is to complicated this double tap on the home button and then closing the app from there. – alinoz Jun 11 '12 at 16:41
  • @alinoz: Then the question is *why*. If they don't want your app to be using data in the background, then add a setting to not use data in the background! – tc. Jun 11 '12 at 17:14
  • @alinoz: you can make your app quit (instead of going background) when the home button is pressed by setting `UIApplicationExitsOnSuspend` in your app plist file. – sergio Jun 11 '12 at 18:32
  • @sergio the requirements are to have background mode (voip) and to have a way to quit directly from the app :( – alinoz Jun 11 '12 at 18:37
0

Unfortunately There is no any officialy way to force app to background state(Pause state).

iOSPawan
  • 2,884
  • 2
  • 25
  • 50