Skip to content
This repository has been archived by the owner on May 13, 2019. It is now read-only.

Couldn't call lockscreen from app delegate #29

Open
kalaichelvan opened this issue Mar 14, 2013 · 2 comments
Open

Couldn't call lockscreen from app delegate #29

kalaichelvan opened this issue Mar 14, 2013 · 2 comments

Comments

@kalaichelvan
Copy link

I tried to use your KKPasscodeLock in my Project. Incorporated the settings view controller and passcode view controller successfully.

So far managed to setup everything. Can set passcode lock and can change as well.

But when i try to set in AppDelegate to display lock screen, it doesn't show up. therefore no passcode being asked after set.

Appreciate if someone could help.

below is my code in appdelegate.m

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {

    [self customizeAppearance];
    [self configureiPhoneTabBar];
    // [MKiCloudSync start];

    [[KKPasscodeLock sharedLock] setDefaultSettings];
    [KKPasscodeLock sharedLock].eraseOption = NO;

    return YES;

}

  • (void)applicationDidBecomeActive:(UIApplication *)application
    {
    if ([[KKPasscodeLock sharedLock] isPasscodeRequired]) {
    KKPasscodeViewController *vc = [[KKPasscodeViewController alloc] initWithNibName:nil bundle:nil];
    vc.mode = KKPasscodeModeEnter;
    vc.delegate = self;

    dispatch_async(dispatch_get_main_queue(),^ {
        UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
    
        nav.navigationBar.tintColor = _navigationController.navigationBar.tintColor;
        nav.navigationBar.translucent = _navigationController.navigationBar.translucent;
        nav.navigationBar.opaque = _navigationController.navigationBar.opaque;
        nav.navigationBar.barStyle = _navigationController.navigationBar.barStyle;
    
    
        [_navigationController presentViewController:nav animated:YES completion:nil];
    }); 
    

    }
    }

  • (void)shouldEraseApplicationData:(KKPasscodeViewController*)viewController
    {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"You have entered an incorrect passcode too many times. All account data in this app has been deleted." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    }

  • (void)didPasscodeEnteredIncorrectly:(KKPasscodeViewController*)viewController
    {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"You have entered an incorrect passcode too many times." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    }

@kalaichelvan
Copy link
Author

@vinhnx I managed to solve the problem. will update the code later when I back to my computer. So others can benefit from it.

@ClickedApps
Copy link

I still can't do it =[

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants