Dailycode.info

Short solution for short problems

iOS : Simple logon procedure

Here a simple example to do a login check for your app. It compares the entered password with a password stored in the variable cache:

- (IBAction)btnLogin:(id)sender

{

    VariableStore *store = [VariableStoresharedInstance];

    NSComparisonResult res = [store.User.Password compare: self.txtPWD.text];

    

    if (res == NSOrderedSame)

    {

        //Do segue

        [selfperformSegueWithIdentifier:@"LoginIN"sender:self];

    }

    else

    {

        //Show wrong pwd

        self.lblError.text = @"Wrong password!";

    }

}