Reset keychain on the device

前端 未结 3 600
渐次进展
渐次进展 2021-01-01 08:33

I\'m testing login flow (using KeychainItemWrapper) inside my app on a device. How do I reset/delete keychain for my app?

On the Simulator, I do it by c

3条回答
  •  鱼传尺愫
    2021-01-01 09:20

    • Download and add keychainWrapper from here into your project.
    • Write following code in the viewController you want to reset keychain.

    CODE:

    #import "KeychainItemWrapper.h"
    
    @interface YourViewController ()
    {
        KeychainItemWrapper *keychainItemWrapper;
    }
    
    - (void)viewDidLoad {
    
        [super viewDidLoad];
    
        keychainItemWrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"appname" accessGroup:nil];
    
    }
    
    - (IBAction)logoutButtonPressed:(id)sender {
    
        [keychainItemWrapper resetKeychainItem];
    
    }
    

提交回复
热议问题