ios - 我可以在 iOS 中存储多少个钥匙串(keychain)?

标签 ios keychain keychainitemwrapper

我正在使用 keychainWrapper。 ios 中的钥匙串(keychain)使用预定义的常量存储,它们是:

kSecAttrAccessGroup
kSecAttrCreationDate
kSecAttrModificationDate
kSecAttrDescription
kSecAttrComment
kSecAttrCreator
kSecAttrType
kSecAttrLabel
kSecAttrIsInvisible
kSecAttrIsNegative
kSecAttrAccount
kSecAttrService
kSecAttrGeneric

这是否意味着我可以使用的钥匙串(keychain)数量有限?我曾经使用过自定义 key ,但它不起作用:

KeychainItemWrapper *keychain = [[KeychainItemWrapper alloc] initWithIdentifier:[[NSBundle mainBundle] bundleIdentifier] accessGroup:nil];
[keychain setObject:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"myUDID"];

但是这样做:

[keychain setObject:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:(__bridge NSString *)kSecValueData];

那么,有没有办法让我存很多钥匙串(keychain)?我可以用不同的标识符初始化我的钥匙串(keychain)以节省更多钥匙串(keychain)吗?像这样:

anotherKeychain = [[KeychainItemWrapper alloc] initWithIdentifier:@"TestUDID" accessGroup:nil];
[anotherKeychain setObject:udid forKey:(__bridge id)(kSecAttrAccount)];

How to store a string in KeyChain , iOS?

最佳答案

您可以拥有任意数量的钥匙串(keychain)项(您所说的钥匙串(keychain)实际上是钥匙串(keychain)项)。每个项目只定义了有限数量的属性——你已经列出了这些。标识符是您喜欢的任何字符串,数据是您要针对该项目存储的值。

您还可以使用许多框架来简化事情 - http://cocoapods.org/?q=Keychain

关于ios - 我可以在 iOS 中存储多少个钥匙串(keychain)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33094631/

相关文章:

ios - ios 中的钥匙串(keychain)是线程安全的吗?

ios - 如何在Sprite Kit中检测碰撞?

ios - iOS 钥匙串(keychain)中的项目会在应用程序卸载并重新安装后继续存在吗?

Github 不缓存我的密码

iphone - 使用 iphone sdk 保存钥匙串(keychain)时出错

iOS,钥匙串(keychain) : Wrong passcode output

ios - FBSDKCoreKit错误: "Include of non-modular header inside framework module"

ios - UIBarButtonItem 上的自定义背景/透明背景?

iphone - 如何使用 Singleton 来允许各种 View Controller 之间的通信?