iOS 輕量級安全第三方庫 SSKeychain

SSKeychain  這個庫是對iOS安全框架的封裝,使用起來極其簡單。

git:https://github.com/samsoffes/sskeychain


這裏貼下使用代碼:

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [SSKeychain setPassword:@"123" forService:@"com.service.service" account:@"account"];
    NSString *password  = [SSKeychain passwordForService:@"com.service.service" account:@"account"];
    NSLog(@"password = %@",password);
    
    
    // Getting Accounts
    NSArray *accounts = [SSKeychain allAccounts];
    NSLog(@"accounts = %@",accounts);
    
    accounts = [SSKeychain accountsForService:@"com.service.service"];
    NSLog(@"accounts = %@",accounts);
    
    // Deleting Passwords
    [SSKeychain deletePasswordForService:@"com.service.service" account:@"account"];
    password = [SSKeychain passwordForService:@"com.service.service" account:@"account"];
    
    NSLog(@"password = %@",password);
    
    
}
代碼下載:http://download.csdn.net/detail/qqmcy/8520719

發佈了488 篇原創文章 · 獲贊 22 · 訪問量 115萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章