天天看点

安卓设置keychain_SAMkeychain的简单使用

SAMkeychain可以用来储存用户的隐私信息。

安卓设置keychain_SAMkeychain的简单使用

结构展示

一:储存数据

+ (BOOL)setPasswordData:(NSData *)password forService:(NSString *)serviceName account:(NSString *)account;

+ (BOOL)setPasswordData:(NSData *)password forService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error __attribute__((swift_error(none)));

+ (BOOL)setPassword:(NSString *)password forService:(NSString *)serviceName account:(NSString *)account;

+ (BOOL)setPassword:(NSString *)password forService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error __attribute__((swift_error(none)));

二:获取数据

+ (NSData *)passwordDataForService:(NSString *)serviceName account:(NSString *)account;

+ (NSData *)passwordDataForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error __attribute__((swift_error(none)));

+ (NSString *)passwordForService:(NSString *)serviceName account:(NSString *)account;

+ (NSString *)passwordForService:(NSString *)serviceName account:(NSString *)accou;

三:删除数据

+ (BOOL)deletePasswordForService:(NSString *)serviceName account:(NSString *)account;

+ (BOOL)deletePasswordForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error __attribute__((swift_error(none)));

四:获取所有帐号信息

+ (NSArray *> *)allAccounts;

//NSArray *allAccounts = [SAMKeychain allAccounts];

+ (NSArray *> *)allAccounts:(NSError *__autoreleasing *)error __attribute__((swift_error(none)));

+ (NSArray *> *)accountsForService:(NSString *)serviceName;

+ (NSArray *> *)accountsForService:(NSString *)serviceName error:(NSError *__autoreleasing *)error __attribute__((swift_error(none)));

//通过下面方法可以配置筛选的信息,

- (NSArray *> *)fetchAll:(NSError **)error;

安卓设置keychain_SAMkeychain的简单使用

瞪谁谁怀孕