关于ios KeychainItemWrapper存储对象以外的用户名/密码 [英] About ios KeychainItemWrapper store username/password other than object

查看:132
本文介绍了关于ios KeychainItemWrapper存储对象以外的用户名/密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道使用下面的KeychainItemWrapper类方法保存用户名/密码,但是我想在KeychainItemWrapper中另外使用一个[ipTF文本].怎么做?

I know save username/password use KeychainItemWrapper class method below, but I want an additional [ipTF text] in KeychainItemWrapper. How to do it?

KeychainItemWrapper *keychainItem = [[KeychainItemWrapper alloc] initWithIdentifier:@"Login" accessGroup:nil];

[keychainItem setObject:[useridTF text] forKey:(__bridge id)(kSecAttrAccount)];
[keychainItem setObject:[passTF text] forKey:(__bridge id)(kSecValueData)];
[keychainItem setObject:[ipTF text] forKey:@"ip"];//not success!

推荐答案

我认为不可能在键链项中创建任意键/值对.

I don't think it's possible to create arbitrary key/value pairs in the key chain items.

钥匙串服务参考

本节列出了所有指定钥匙串项目属性的钥匙.每个项目的说明都表明该键的可能值.

This section lists all the keys that specify keychain item attributes. The description of each item indicates what the possible values are for that key.

可能的键列表由kSecClass确定.您可以在描述了如何确定钥匙集.

The list of possible keys is determined by the kSecClass. You can find the list of options and their descriptions in the Keychain Services References under the following quote describing how the key set is determined.

用于在搜索字典中设置项目类别值的键常量.

Key constant used to set the item class value in a search dictionary.

CFTypeRef kSecClass;

常量

kSecClass

字典键,其值 是商品的类别代码.该密钥的可能值列在 "项目类别值常量."

Dictionary key whose value is the item's class code. Possible values for this key are listed in "Item Class Value Constants."

这篇关于关于ios KeychainItemWrapper存储对象以外的用户名/密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆