如何通过iCloud同步钥匙串 [英] How to sync keychain over iCloud

查看:631
本文介绍了如何通过iCloud同步钥匙串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想在钥匙串中存储我的应用程序的敏感数据。我也希望使用iCloud来同步设备。

I wan't to store sensitive data for my app in the keychain. I'd also like this to sync over devices, using iCloud.

根据Apple的说法,这是可能的:

According to Apple this is possible:


iCloud Keychain是否适用于第三方应用程序?

Does iCloud Keychain work with third-party apps?

是的。开发人员可以更新他们的应用程序以使用iCloud Keychain。
这些应用程序保存的密码在
使用该应用程序且使用iOS 7.0.3或更高版本或OS X Mavericks v10.9
或更高版本的所有设备上保持最新。

Yes. Developers can update their apps to work with iCloud Keychain. Passwords saved by those apps are kept up to date on all devices that use the app and are using iOS 7.0.3 or later or OS X Mavericks v10.9 or later.

但是,我找不到有关应用程序所需内容的任何文档。如果用户启用了iCloud Keychain,是否会同步钥匙串的所有内容?

However, I can't find any documentation about what is needed by the app. Will all content of the keychain be synced if the user has enabled iCloud Keychain?

推荐答案

添加任何项目时,需要设置 kSecAttrSynchronizable 属性你想要同步。我建议使用一个包装库,如 KeychainAccess (在swift中)或 UICKeyChainStore (在Obj-C中),因为它在很大程度上促进了钥匙串和各种属性的处理(它们都提供了可同步属性)

You need to set the kSecAttrSynchronizable attribute when adding any item that you want to be synced. I would suggest using a wrapper library such as KeychainAccess (in swift) or UICKeyChainStore (in Obj-C), as it largely facilitates the handling of the keychain and of the various attributes (they both provide a synchronizable property)

这篇关于如何通过iCloud同步钥匙串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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