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.
Related
I want to control the iphone device programmatically.
I mean,when user want to switch off the phone one alert message will come.it will
ask the password then only the operation will work.
when user delete the app from the his/her device one alert will come and ask the
password for the security reasons.
what type of the frame works required for handling the power button as well as the app
control on the device.
I mean,when user want to switch off the phone one alert message will come.it will ask the password then only the operation will work.
You can't
when user delete the app from the his/her device one alert will come and ask the password for the security reasons.
You can't.
But you could use Apple's Configurator to configure iOS devices with profiles of you company. This way the user won't be able to uninstall the app.
The Apple configurator can do lots of other things as well. Think about setting up restrictions, accounts, password, security and other things on the device.
There are even Over The Air Updates possible of you use a Mobile Device Management Server or Service
I developed an iPhone app. User need to log in to update their credentials. I'm using iOS Keychain feature to store the username and password. So, next time user launch the app user will be logged in. I would like to add remember me feature in my app. So, user will have an option to check the remember me or not.
My question is if the user don't want to remember his credentials, when I'm suppose to clear the keychain? How do I know if the app is closing/shutdown?
– applicationWillResignActive:
– applicationDidEnterBackground:
These two methods are called depending on the situation when the app enters background.(sleep button/phone call etc).
You can look it up in the docs.
https://developer.apple.com/library/IOs/#documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UIApplicationDelegate
You meed to write the login credentials to application preferences.
(Here is how to read write to iPhone app preference)
http://knol.google.com/k/iphone-sdk-application-preferences#
Also here is how to read default preferences
http://www.redcodelabs.com/2009/07/read-iphone-preferences/
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.
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.
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.