How to sync keychain over iCloud

元气小坏坏 提交于 2019-12-30 06:17:47

问题


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

According to Apple this is possible:

Does iCloud Keychain work with third-party apps?

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.

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?


回答1:


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)



来源:https://stackoverflow.com/questions/33775569/how-to-sync-keychain-over-icloud

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!