Question

I want to integrate a passcode into my existing application. Does anyone know of any good tutorials, or such that would lend to my search? Is there a standard Apple tutorial to integrate one? I've not been able to find one, but I imagine it'd be as simple as putting a keypad view in the didFinishLaunching & resignActive methods right? Would keychain be a good place to store it? Again, I'd hate to reinvent the wheel on this, especially if there is a proven secure method out there. Here is the one good tutorial I've been able to find, but it doesn't incorporate a view, or multiple invoke points. http://gorgando.com/blog/topics/technology/iphone_development/simple-iphone-tutorial-password-management-using-the-keychain-by-using-sfhfkeychainutils

Thanks!

Was it helpful?

Solution

I've been through this, but I don't have any link with an Api or something you can use, but some advices:

-with multitasking you should call the passcode view in the becomeActive method in the app delegate too, the way that your app could prompt for a passcode when in returns from background.

basically you have to call de passcode in two methods:

- (void)applicationDidEnterBackground:(UIApplication *)application

- (void)applicationDidBecomeActive:(UIApplication *)application

the first one is called before going background, and it is better to call to present the code lock view before going to background than after, because if you call this after, you should probably see the application as you left it before going to background, before the code lock view is presented.

the second one, is kinda obvious =D, but you have to control not to present the code lock twice, because the second method is also called when you return from background.

-Related to the password, it can be stored in some custom configuration file, such us a plist with a little encryption.

-Related to the view, you can create your own viewController with some protocols that handles this kind of behavior. Not big deal.

Hope this helps, bye

OTHER TIPS

NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];

if (standardUserDefaults) 
{
    [standardUserDefaults setObject:passCodeTextField.text forKey:@"lock"];
    [standardUserDefaults synchronize];
} 

if you have any saving scheme then put this in particular action othervise set this at the first time application launch.

check in appDelegate put proper if else condition then use above code

Now you can access this passcode

NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults]; if (standardUserDefaults) self.passCodeString = [standardUserDefaults objectForKey:@"lock"];

And you can use this in a perticular view (for passcode).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top