iPhone app login issue - iphone

I have an iPhone application which I'm working on and so far i have created a login page for the application such that only the phone's user can access the application. The login works fine and the application works fine, but when i hit the home button, the app is "minimized". And if accessed again from the task switcher it doesn't prompt for a password.
What exactly would be the best way to go about getting the app to request a password. If it helps i use navigation controllers and i have one view dedicated for the login.
Thanks for the help.

Can't you check app activated in the appdelegate?
- (void)applicationDidBecomeActive:(UIApplication *)application {
[self showLoginWindow];
}

You must be working on iOS4. When you hit on Home Button, your app goes into background mode, but still working. So next time, when you open it, it starts exactly from where you left it. Implement the
- (void)applicationDidBecomeActive:(UIApplication *)application
method, to check for login again. Or if you don't want the background processing at all, disable it or use following code
- (void)applicationDidEnterBackground:(UIApplication *)application {
exit(0);
}
EDIT -
Don't go for exit(0) approach, simply disable the background processing if you don't want it from info.plist file.

see this link
you need to prevent the app to load from background.

Related

How to show rate this app message on dashboard

Is it possible to use appirater, iRate or other method to show "rate this app" message when user go back to dashboard. I tried to use appirater in applicationdidenterbackground. But the message didn't show.
When your application is going to background the popup won't be visible for a user - it will be shown within your app. You can show it when user goes back to your app using:
- (void)applicationWillEnterForeground:(UIApplication *)application

iphone home button event

I am developing a iPhone application and would need to track the home button pressed event by user while the app is in background mode.I have go through the apple documentation/apis but could not find out any to track.
It would be great if anyone can help me on this to track the iPhone home button pressed event.
Your application can't catch any events while in the background. There are some special cases which allows your app to do some tasks in the background, but even them wouldn't allow you to listen to Home button interaction.
You cann't track the home button pressed or not but as your situation is to see if application went in background or not. for this there is a method applicationDidEnterBackground:(UIApplication *)application. This method is called as the application enters into background.
- (void)applicationDidEnterBackground:(UIApplication *)application
{
NSLog(#"Application Entered Into Background.");
}

iPhone : killing the process from multitasking

Why debugger didn't launch to - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions when I launch the App after killing my app process from multitasking ? "killing app process from multitasking" mean to make double click on "Home" button, after that, at the bottom of iPhone menu with active apps will be shown, and than I delete my app there. thanks...
If you launch your app from the iPhone screen (pressing its icon) after you have killed it, the debugger is not attached to it any more, hence it will not launch. You need to trigger the application from XCode again.
If the app's getting killed, regardless of from where, - (void)applicationWillTerminate:(UIApplication *)application will get called. application:didFinishLaunchingWithOptions: only gets called when the app launches, not when it quits…hence the names.

Maintain Session State in IPhone Application

HI, I want to maintain the session in my iphone application. If the application enter in to background state or application is not active i have to move the user to loging screen. How to do this one?
I saw this example but it is not help me to resolve the issue:
How to maintain Session for iphone
You can follow similar concept. When user logging in put some thing as NSUserDefaults like
[[NSUserDefaults standardUserDefaults] setValue:#"ABCDEFGHIJK" forKey:#"SessionKey"];
and in application delegate there is one method called
(void) applicationDidEnterBackground:(UIApplication *)application
which will be called when application is going in background. Just remove that set variable for the sessionkey. And while application is again being launched just check the condition and redirect user to desired screen.
Hope this helps.

Awake from sleep event on the iPhone?

Is there any way to detect if the iPhone wakes up from sleep while you're app is running? Eg: your app is running, the user locks the screen (or the screen auto locks) and some time later the user unlocks the screen and up pops your app. Is there some way to get an event at that point or detect it somehow?
I've tried searching the Google and this forum, but I can't seem to find anything about it.
See applicationDidBecomeActive: on UIApplicationDelegate.
Stick these in you AppDelegate.m file:
-(void) applicationWillResignActive:(UIApplication *)application {
NSLog(#"Asleep");
}
-(void) applicationDidBecomeActive:(UIApplication *)application {
NSLog(#"Awake");
}
#Kevin - Nothing wrong with your answer - thanks by the way. Just thought I'd save the next person a Google search.