Is there any way to programatically send my iPhone app to the background

I have an iPhone app that I need to send to the background automatically. The app is defined with the VOIP key in its background modes so it should continue running when in background. I specifically need the app to keep running so calling exit(0) is no good.

The app will not be distributed via app store so using a private API is ok.

  • How to use both google+ and facebook login in same appdelegate.swift
  • Xcode stuck at “Your application is being uploaded”
  • Google plus API for posting on wall like Facebook
  • iphone keyboard not hiding when tapping the screen
  • UITableView scrolling problems when inside a UIScrollView
  • Adding QLPreviewController as subview doesn't load PDF
  • I have read about UIApplication terminate and UIApplication terminateWithSuccess but they don’t seem to be available anymore

    2 Solutions Collect From Internet About “Is there any way to programatically send my iPhone app to the background”

    Already answered quite well here:

    Suspend the application

    As that poster wrote:

    Quitting your application or sending it to the background programmatically is a violation of the [iOS Human Interface Guidelines][1], which usually doesn’t bode well for getting through the review process:

    Don’t Quit Programmatically

    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.

    While I agree with the other answer that you “shouldn’t” exit programatically. There is a way to exit programatically.

    *disclaimer – You shouldn’t do this.

    exit(0);
    

    There is no way to put the application into the background without pressing the home button. If there is, you might want to add the jailbreak flag to your question and ask them.

    For more, check this duplicate question, Proper way to exit application.