SAMkeychain的简单使用

作者: 木马不在转 | 来源:发表于2017-03-09 17:59 被阅读2177次
    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<NSDictionary<NSString *, id> *> *)allAccounts;
    //NSArray *allAccounts = [SAMKeychain allAccounts];
    + (NSArray<NSDictionary<NSString *, id> *> *)allAccounts:(NSError *__autoreleasing *)error __attribute__((swift_error(none)));
    
    + (NSArray<NSDictionary<NSString *, id> *> *)accountsForService:(NSString *)serviceName;
    + (NSArray<NSDictionary<NSString *, id> *> *)accountsForService:(NSString *)serviceName error:(NSError *__autoreleasing *)error __attribute__((swift_error(none)));
    //通过下面方法可以配置筛选的信息,
    - (NSArray<NSDictionary<NSString *, id> *> *)fetchAll:(NSError **)error;
    

    gitHub传送门

    瞪谁谁怀孕

    相关文章

      网友评论

        本文标题:SAMkeychain的简单使用

        本文链接:https://www.haomeiwen.com/subject/iwcggttx.html