I'm currently working on an iPhone app that requires the user to accept a terms of use/disclaimer. If the user does not accept the disclaimer, I would like the app to close.
It is my understanding that exit(0); is frowned upon (as discussed at Proper way to exit iPhone application?) and the Human Interface Guidelines state that the only time an application should close is via user intervention.
What is the best practice for stopping the functionality of my app if the user presses a 'Reject' button for the disclaimer?
Should exit(0); be called, or is there a more graceful way to close the app? I'm not necessarily worried about removing the app from memory -- I'm just wanting the app to kick the user back to the home screen.
Does the user pressing a 'Reject' button constitute user intervention, consistent with the Human Interface Guidelines?
The correct way to handle this would be to write your terms into the EULA that goes along with your application. The gatekeeper then becomes the App Store, and this problem goes away. You can then assume that anyone running your app has agreed to the terms.
Apple provides a standard EULA, but your laywers can supply you with a custom one. Apple just has a few requirements that that custom EULA's terms must meet.
In my opinion, the best thing to do after user taps "reject" is to give him a sorry message without any button to proceed. In other words, the user will have nothing to do without pressing the home button. It's better than exit(0) as that looks like a crash.
In my case I had a message at the beginning of my app stating that some amount of data should be downloaded before continuing, with two buttons to "Continue" or "Exit" the app. The "Exit" button didn't really exit but just bring to front the Safari browser to show our home page.
And this app got rejected by the App Store reviewers just because of that Exit button. The funny thing is they rejected the app when submitting my second update to the original version! (the two previous versions had been approved just fine and had that very same "Exit" button).
Anyway, it seems it's important not to exit your app in any way.
Your app will almost certainly be rejected if you force it to quit programatically. You should simply present a pop-up informing the user they cannot use the app unless they accept the disclaimer, and ask them to press the Home button to exit. Basically, don't kick the user out of the app at any point. Let them decide when to leave.
Related
I have a button in my app to make a telephone call, and I need to returen to my app after call is finished.
Is there any way to do this?
Can't be done. The user will have to open your app themselves.
If you mean that the user can make a phone call to another user, starting from your application, which closes said application, then what you are asking is simply impossible. The best you can do is have the application get into suspended mode. The user will need to get it back from the tray.
If for some reason your application has a button that calls the user (possibly by triggering some external server), then you should edit your question to be clearer... however, the user still needs to get your application back himself from suspended state.
Is there a way to send a rating to the app store from within my app without opening iTunes or the AppStore or leaving my app?
This question is not a duplicate of this question: App Store Review Button or its myriad duplicates. I know how to set up an alertView that prompts the user to rate the app and then opens the AppStore to the correct page for the user to give a rating and/or write a review.
What I would prefer to do is to pop up a view with five stars so that when the user selects a star, it and all the stars to its left are highlighted (done that). Then, if the user clicks a button entitled "Submit", the rating will be submitted to the AppStore, but the user will stay in my app. I suppose that Apple will pop up a password request, similar to what happens when updating apps. That's fine, so long as it doesn't cause the user to leave the app.
I realize that this will require an internet connection, and I know how to test for connectivity and the like, so I'm not concerned with that aspect.
Does anyone have a solution for how to achieve this?
You cannot rate an app programmatically, from outside the app store. If it were possible, lots of developers would take advantage of it and would rate their apps with 5 stars without the users noticing which would defeat the purpose of a rating system. Even if a password dialog would pop up, a lot of users would not understand why it pops up and simply enter their passwords.
Naturally this is programmatically possible (using enabledRemoteNotificationTypes). This is a policy question.
Can I require that a user has push notifications enabled to be allowed to use an app, or will this behaviour cause the app to be rejected by Apple?
The App Store Review Guidelines includes a section on push notifications (§ 5), but does not cover this.
Sometimes I might not want any notification from any application because I am busy. Therefore I turn Notifications on or off as I choose. All you can do is display an UIAlertView reminding the user that push notification is disable when they enter your app.
Submit and see what happens. First, try it with the app closing itself if the user has push notifications turned off, showing them an alert letting them know why the app won't run and how to fix it (and a button that will take them to the right part of Settings if that's possible). If Apple rejects it, then just take out the app quiting code and let them continue by dismissing the nag screen.
Like you say, there's nothing explicitly forbidding it in the guidelines that you can find, so the only way to get an answer is to submit code and see what happens, since you generally can't get a straight answer out of Apple regarding these issues until you have something specific and real for them to consider.
The iPhone app I'm writing has an option in the SETTING page: "ask for password when launching this app". (As a security measure.)
If the user types in the correct password... the app runs.
If the user types in the wrong password... the app needs to immediately exit.
There isn't any kind of "immediately exit this app" in any framework (that I can find).
What is the app-store legal way to do this?
http://developer.apple.com/library/ios/#qa/qa2008/qa1561.html
There is no API provided for gracefully terminating an iPhone application. Under the iPhone OS, 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.
Just display a screen that says "The password you entered is invalid." Not sure why you wouldn't allow them to try again, though - I'd find being made to relaunch the app each time I make a typo quite frustrating.
There is none. Applications are not supposed to exit. What you can do, however, is what an application I wrote that needed network access does: present a UIAlertView with no buttons so that the user is forced to quit the app (press the home screen button).
Just keep in mind that with iOS 4.0 and multitasking, you’ll have to give the user another opportunity to enter the password if the application is put into the background and then restarted.
You can use
exit(0);
although not recommended as explained by others.
I have built a small app that gets informations from a database on a website.
the first thing the app does is to fetch an rss feed and then display it.
Apple guidelines tell to let the user decide if he/she wants to connect to the Internet, so I have placed an alert at the beginning showing "The app will connect to the Internet. Continue?" with two buttons: "Yes", and "No, quit"
if the user chooses "No, Quit", then I call:
[[UIApplication sharedApplication] terminateWithSuccess];
It Works. But I have read that Apple disencourage that, (Not an official API???) and that the only way to terminate an app should be the use of the Home button.
I tried an alernative: if the user press "No, Quit" I simply show a label that says "Quit the app using the Home Button"...
So, what should I do? leave the alert and quit the app or just show the "please quit" label???
You may never actively terminate your app, otherwise Apple will reject the app (I know by experience ;-). Only thing you can do is show a dialog, e.g. a UIAlertView without any buttons, asking the user to quit via home button.
But I never heard about the guidelines you've cited regarding an Internet connection. Please give a link. I've worked on a lot of apps that connect to the Internet without asking and Apple never complained.
Just leave off the "No" button.
Either the user will hit "Yes" and connect, or the user will terminate (or background) your app by switching to another app, since they have no other choice.
App termination by simply forcing the user to do something reasonable.