简体   繁体   English

我可以在iOS中存储多少个keyChain?

[英]How many keyChain can I store in iOS?

I'm using keychainWrapper. 我正在使用keychainWrapper。 The keychain in ios stored using a pre-defined constant, which are these: 使用预先定义的常数存储的ios中的钥匙串是:

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

Does that mean I have restricted number of keychain I can use? 这是否意味着我可以使用的钥匙串数量有限? I once used a custom key, and it doesn't work: 我曾经使用过一个自定义键,但是它不起作用:

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

But this does: 但这确实是:

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

So, is there anyway for me to save many keychain? 那么,我是否还需要保存许多钥匙串? Can I to init my keychain with a different identifier to get save more keychain? 我可以使用其他标识符初始化钥匙串以节省更多钥匙串吗? Like this: 像这样:

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

How to store a string in KeyChain , iOS? 如何在iOS的KeyChain中存储字符串?

You can have any number of keychain items (what you are referring to as key chains are actually keychain items). 您可以有任意数量的钥匙串项目(您所说的钥匙串实际上是钥匙串项目)。 Each item only has a limited number of attributes defined - you have listed these. 每个项目仅定义了有限数量的属性-您已列出了这些属性。 The identifier is whatever string you like and the data is the value you want to store against that item. 标识符是您喜欢的任何字符串,数据是您要针对该项目存储的值。

There are also a number of frameworks you can use to simplify things - http://cocoapods.org/?q=Keychain 您还可以使用许多框架来简化操作-http://cocoapods.org/?q=Keychain

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM