Exit Application in iOS 4.0

Exit application in iOS 4.0

No still shouldn't do this.

You have handlers for the different stages, so this is how you should do it. There's no point in exiting manually. If you restart the app, ideally it would start where you left off, so this is either by resuming or by starting and loading the old state.

No reason for exit.

Edit

As this keeps popping up again: iOS Human Interface Guidelines says "Don't Quit Programmatically". And we have seen many reports of apps that had calls to exit() in them in the past.

Exiting instead of suspending by setting the appropriate key in the Info.plist file is perfectly fine, of course - but that's not a dedicated UI Button, just application-specific implementation of program exit by the home button.

IOS 4 behavior exit application

If the application have already entered the inactive state (applicationWillResignActive+didEnterBackground) you will not get any further notifications if the application is terminated.

I would though expect your application to stop completely after step 4, but since you didn't get the debugger terminated message (as in step 7) somehow the application didn't terminate fully.

The WWDC 2010 Session 105 - Adopting Multitasking on iPhone OS, Part 1 Video explains the application state transitions extremely well.

Proper way to exit iPhone application?

Have you tried exit(0)?

Alternatively, [[NSThread mainThread] exit], although I have not tried that it seems like the more appropriate solution.

exit application when click button - iOS

exit(X), where X is a number (according to the doc) should work.
But it is not recommended by Apple and won't be accepted by the AppStore.
Why? Because of these guidelines (one of my app got rejected):

We found that your app includes a UI control for quitting the app.
This is not in compliance with the iOS Human Interface Guidelines, as
required by the App Store Review Guidelines.

Please refer to the attached screenshot/s for reference.

The iOS Human Interface Guidelines specify,

"Always Be Prepared to Stop iOS applications stop when people press
the Home button to open a different application or use a device
feature, such as the phone. In particular, people don’t tap an
application close button or select Quit from a menu. To provide a good
stopping experience, an iOS application should:

Save user data as soon as possible and as often as reasonable because
an exit or terminate notification can arrive at any time.

Save the current state when stopping, at the finest level of detail
possible so that people don’t lose their context when they start the
application again. For example, if your app displays scrolling data,
save the current scroll position."

> It would be appropriate to remove any mechanisms for quitting your
app.

Plus, if you try to hide that function, it would be understood by the user as a crash.

iOS: Exit from the app to Home Screen programmatically with gracefully exit with animation?

Code:

   @IBAction func minimizeOrKillApp(){            
UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)
//Comment if you want to minimise app
Timer.scheduledTimer(withTimeInterval: 0.2, repeats: false) { (timer) in
exit(0)
}
}

Output

Download sample code

It is not recommended and your app will be rejected. We all are the developers and We know to how to approve it from reviewer team

Apple developer question

Exit an application or Go to Dash board(main page) programmatically - IOS

exit(0); will work but don't use it

You shouldn't force close an app as the standard way to terminate an application is to press the home button (or use the multitasking bar)

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.

Source

Want app upgraded to 4.0 to exit completely when home button pressed

Open your info.plist file

Add The Key UIApplicationExitsOnSuspend or Select Application does not run in background

Set the new key to YES or Fill in the tick box

How to exit an IOS application when License Agreement is not accepted by user?

Do not crash or force close or find ways to close your application. If user's doesn't accept the agreement then they might not be interested in using your application eventually they will delete it. BUT, do as the protocols say, Display an agreement alert (if you already have an EULA) then point towards the same and ask user that they will have to accept the agreement in order to use the application.

Other ways could be, give a preview of some of the screens (for those who doesn't accept the EULA), if they like your screens then ask for agreement acceptance.

Hope it helps.



Related Topics



Leave a reply



Submit