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.
I have read about UIApplication terminate and UIApplication terminateWithSuccess but they don’t seem to be available anymore
- Apple LLVM Compiler Error 4.1
- Swift - which types to use? NSString or String
- UILocalNotification is supposed to repeat every weekday, but fires on weekends as well
- Linker error in Xcode?
- Record, save and/or convert video in mp4 format?
- How to declare instance variables and methods not visible or usable outside of the class instance?
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], 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
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
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.
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.
- Downloading a file from url and saving to resources on iPhone
- UIColor Swift gives a different Color
- Swift 2 :IBOutlet Collection ! leaks memory
- Count colors in image: `NSCountedSet` and `colorAtX` are very slow
- Detect delete key using UIKeyCommand
- HTML Content fit in UIWebview without zooming out
- MapKit based app crashing when loading from plist
- ios endless video recording
- How to draw multiple UIBezierPath with different colors in a UIView
- Best practice when implementing copyWithZone:
- How to fix “nib but didn't get a UITableView” error?
- Why AVSampleBufferDisplayLayer stops showing CMSampleBuffers taken from AVCaptureVideoDataOutput's delegate?
- Draw a straight line using OpenGL ES in iPhone?
- Add a “Full Name” Field to Firebase Email/Password Authentication?
- Adding swift file to new view controller in xCode? (easy)