iOS Development: Is there ever a time when it's appropriate for an app to kill itself? - ios

I've been developing iOS apps for enterprise use for several years now. It was an adjustment from having spent many (!) years developing desktop apps. One of the first things I learned very early on was that it is frowned upon for an app to kill itself. The posters in the Apple dev forum were downright hostile about it, which is a reason I never go there anymore.
Now I have an app that has very critical functions, and it requires that the user accept the terms and conditions before using the app, and that the app will not function if the terms have not been accepted. The choice is there to accept or to decline, but it seems like the best thing to do when the user actively declines is to kill the app entirely.
My question is, under those circumstances, would there be anything wrong with that? Will I be damned to developers hell for eternity?

You can change the interaction here.
Instead of accept (and use the app) or decline (and never be able to use the app) change it to accept (and use the app) or nothing.
If the user does not accept then they cannot use the app. They do not have to decline anything. Absence of acceptance is all you need.
If they don't accept then don't do anything. They can always come back later and accept and start using the app.

Why kill an app on a declying? I would rather just leave a user at the same screen with no actions before he puts acceptance checkbox, disabling all buttons

If you make the app kill itself, Apple won't let you post it on the App Store.
You should adjust your User Experience to the case of the user declining the terms and conditions.
For example, show a screen saying that the app can't be used unless terms are accepted, with a button saying "Take me back" that takes the user back to the terms screen.

Related

Force removal/invalidation of iOS app from user devices

Assuming you created an app that users have downloaded that is just awful and you neither want to fix it nor have anyone continue to use it so that it won't tarnish your brand, is there a way to end its life on user's iOS devices?
Curious if there is some store setting to force it to work with earlier versions of iOS and invalidates the current app, or code that would force an update that says the app is no longer available.
As many have confirmed, there is no way to remove an application from someone's device. For these cases though, many companies have servers that the application sends a request to on launch, that returns either a need to update the app, a message, or to tell the user the app has been discontinued and that the app cannot be used anymore, stopping them from using the app from there on.
The last use case might be useful to you, but of course this is a proactive solution, not a reactive one.

Will providing a user-selectable option to quit an iOS app result in its rejection by Apple

I am working on an app that I feel would enhance the user experience if it provided an option for users to quit the app. This option would only be available from one of its screens.
I have researched this idea and I am fully aware of the following:
Technical Q&A QA1561
Quit iOS Application Programmatically with UIAlertView
Is it possible to quit iOS app after we do some checks
However, what I am proposing is a situation where one of the screens provides users with a range of options via a number of buttons. Each button has an icon and is clearly labelled.
Since the Quit App option would allow users to manually quit the app, the user will not then think the app has crashed. And, because the function of the button is to quit the app, then this isn't a case where the app was unable to provide its intended function. In fact, it's the exact opposite as the intended function is to quit the app.
My question is:
If this is a user-selectable option that is clearly labelled in terms of what it does, will Apple still reject it? If so, would it make any difference if the app provided a 'confirmation alert' after the user selects the option?
I am hoping that someone can either:
share their experience of having tried the same approach
refer me to an existing app that does this (as an example that it would be approved)
Actually about this Apple provide detailed answer in this link.
Kindly follow it.
Basic Snapshot :
In iOS, the user presses the Home button to close applications. Should
your application have conditions in which it cannot provide its
intended function, the recommended approach is to display an alert for
the user that indicates the nature of the problem and possible actions
the user could take — turning on WiFi, enabling Location Services,
etc. Allow the user to terminate the application at their own
discretion.
Apple is says gave the Warning to developer to do not call exit methods forcefully.
Warning: Do not call the exit function. Applications calling exit will
appear to the user to have crashed, rather than performing a graceful
termination and animating back to the Home screen.
If during development or testing it is necessary to terminate your application, the abort function, or assert macro is recommended.
Hope this will help you.

Is it possible, perhaps with Apple's permission, to switch an app to the foreground without user input?

We would like to be able to remotely control an app on an iOS device so that the app can be automatically brought to the foreground WITHOUT the user having to do anything, for example when the app receives a remote push notification. My understanding is that normally there is no way to bring an app to the foreground in iOS unless the user presses a button, because Apple has decided that it knows best, and that it is better for app developers and users not to have this possibility, because it could be abused.
We are working on a security-related app where we believe that there would be strong justification for this type of functionality (in a case where the user is not able to take any actions).
Two questions:
Is there any way to do this in iOS coding that others on similar posts have overlooked?
Does anyone have experience with whether Apple ever grants exceptions to this kind of rule if there is a good justification?
The answer is simple: NO, and there is no chance that Apple will agree to allow you to implement such functionality. The only app that does this is the Phone.app because that is its purpose.

close application in IOS

I have an in-app subscription product. When the app is loaded, I present a "subscribe now" screen to initiate the buy process. If the user cancels, the application MUST close/move to background/terminate since they have refused the service. What is the best method to use to do this?
This situation is addressed in the iOS Human Interface Guidelines, under "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
For example, consider the iTunes Store or App Store apps, which are useless without a network connection. If you put your device in Airplane Mode and then launch either one, they will display a large Wi-Fi icon with a message saying an Internet connection is required. (I think an alert offers to disable Airplane Mode, but if you tap Cancel you'll see what I mean; the app will not quit.)
Be assured, if you simply force-quit the app, Apple will reject it.
I don't know if it's allowed.. but you can use
Exit(0);
OR:
[[NSThread mainThread] exit];
The application will close.
Best not to do that. You could just display another screen after they hit cancel explaining why they can't continue and give them a button to try again.

How to quit iPhone app with an "intentional exception"?

I know Apple frowns upon closing the app because the user might think it crashed.
So how do I make it quit intentionally with an exception that doesn't get caught when the user goes back to the home screen? Also, would this be rejected by the App Store?
I wrote this answer to another question. It an extract from the Apple Human interface guidelines and should help you understand why you shouldn't quit programatically.
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
Apple will most likely reject it as a violation of the human interface guidelines, so it really doesn't matter how to do it.
So how do I make it quit intentionally with an exception that doesn't
get caught when the user goes back to the home screen?
You don't. If your app is "done," just go back to the initial state. Reset all your variables, release your view controllers, whatever. Pretend that the app actually did terminate, and that the user started it up again. You'll be happy, your users will be happy, and Apple will be happy.
An alternative, if your app truly can't continue for some reason, is to display a message that explains the situation to the user and tells them how to resolve the problem. Leave that message visible until the user leaves the app by pressing the Home button. This can be the only reasonable way to deal with situations where some resource such as network access is missing.
Also, would this be rejected by the App Store?
Nobody can say that for certain other than Apple, but I think the probability of rejection is high.
Please see the answer to this question:
Forcing a background application to terminate in iOS simulator
It will tell you how to setup your application to terminate instead of backgrounding when the user hits the home button.
If you don't want to do that, I recommend you should instead release resources when your delegate's applicationDidEnterBackground fires. I think that is your safest bet. More than one of us say what you're wanting to do is not ideal.

Resources