第三方框架UIKeyChainStore
在我们做app的时候,有些敏感信息需要加密保存。iOS提供keyChain来保存用户敏感信息
使用前准备
1.导入 Security.framework库
2.将UICKeyChainStore.h 和UICKeyChainStore.m导入工程
基本用法
//存储信息
UICKeyChainStore *keychainStore = [UICKeyChainStore keyChainStore];//初始化
[keychainStore setString: access_token forKey:access_Token];
[keychainStore setString: refresh_token forKey:refresh_Token];
[keychainStore setString: account forKey:account];
//读取信息
UICKeyChainStore *keychainStore = [UICKeyChainStore keyChainStore];
if ([keychainStore stringForKey:account]) {
NSString *phoneString = [keychainStore stringForKey:account];
}