iOS add pinpad to secure the app

557 Views Asked by At

I'm building an iPad app in where I need to implement a pin secure lock screen.

I have created a very simple hardcoded password 1234, see below:

- (IBAction)enterPassword
{
    NSString *passwordString = [NSString stringWithFormat:@"1234"];

    if ([passwordField.text isEqualToString:passwordString]) {
        //hide password field
        passwordField.hidden = YES;
        //show main application view
        [super viewDidLoad];


    }
    else {
        // Password is incorrect
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Incorrect Password" message:@"This password is incorrect." delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
        [alert show];
    }
}

Now, how can I implement an ability for user to change the password anytime they want to, so that they are not depended on the hardcoded password.

Also, when they are about to change the password they will be asked for the current old password in order to change it.

Please bare in mind that I'm a very new in iOS developing :(

Many thanks for your help.

0

There are 0 best solutions below