ios 使用keychain来存储token

注意事项:

1.》On iPhone, Keychain rights depend on the provisioning profile used to sign your application.Be sure to consistently use the same provisioning profile across different versions of your application

在iphone中,keychain依靠的是注册应用程序时候的证书。所以需要确保不同的应用程序版本使用相同的证书。

2.》In iOS Keychain Services,certificates, keys, and identities are stored and retrieved in exactly the same way as passwords, except that they have different attributes.

3.》If the password is not on the keychain, then SecItemCopyMatching returns the errSecItemNotFound result code In this case as well, the application displays a dialog to request the user name and password. (This dialog should also include a Cancel button, but that choice was omitted from the figure to keep the flowchart from becoming overly complex.)

4.》If the user selects No, then the routine is finished. If the user selects Yes, then the application calls the SecItemAdd function (if this is a new keychain item) or the SecItemUpdate function (to update an existing keychain item) before ending the routine.

1,为你的应用程序添加keychain服务

SecItemAdd to add an item to a keychain                      使用SecItemAdd添加一个项
SecItemUpdate to modify an existing keychain item                 使用SecItemUpdate来更新现有的项
SecItemCopyMatching to find a keychain item and extract information from it    使用SecItemCopyMatching来查找一个项,使用这个方法后不会弹出提醒让用户允许访问keychain的提醒

SecItemCopyMatching function to find a keychain item owned by your application.In this case there's only one keychain and the user is never prompted to unlock it.

 

 

转载于:https://www.cnblogs.com/lisa090818/p/3429672.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值