+ (NSMutableDictionary *)getKeychainQuery:(NSString *)service {
return [NSMutableDictionary dictionaryWithObjectsAndKeys:
(__bridge id)kSecClassGenericPassword,(__bridge id)kSecClass,
//存储类型、密码、私钥等等
service, (__bridge id)kSecAttrService,
//干什么的
service, (__bridge id)kSecAttrAccount,
//账户名称:区别用户用的
(__bridge id)kSecAttrAccessibleAfterFirstUnlock,(__bridge id)kSecAttrAccessible,
nil];
//信息访问的授权方式:手机是否解锁
}
[keychainQuery setObject:[NSKeyedArchiver archivedDataWithRootObject:data] forKey:(__bridge id)kSecValueData];
//添加存储值
SecItemAdd((__bridge CFDictionaryRef)keychainQuery, NULL);
[keychainQuery setObject:(__bridge id)kCFBooleanTrue forKey:(__bridge id)kSecReturnData];
[keychainQuery setObject:(__bridge id)kSecMatchLimitOne forKey:(__bridge id)kSecMatchLimit];
//查询时数据的过滤方式