简体   繁体   中英

XCode: Adding password protection to an existing ios app

I have a huge tabbed bar application which uses storyboards and is already on the app store - but now I am adding in password protection to it.

I have already implemented a settings page in my app in which the user can toggle whether or not a password is required. They can also change their password here.

However, I can't find a solution to the next stage. Here is some code from my App Delegate:

-(void)requestPassword {
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *passwordON = [defaults objectForKey:@"passwordBOOL"];
    if ([passwordON isEqualToString:@"ON"]) {
        NSLog(@"ON");
    }
    else {
        NSLog(@"Off");
    }
}

As you can see, I am detecting whether or not the password is on or off. If the password is on, how do I go to a different view or set up an overlay password entry view? I am not sure if I should have a separate view for this or run some code from the first view of my app.

Any suggestions are greatly appreciated!

这是经过数周开发后终于找到的答案: Xcode:在applicationDidBecomeActive中显示登录视图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM