简体   繁体   English

iOS-正在保存当前用户-钥匙串和保存到磁盘是否互斥?

[英]iOS - Saving current user - are Keychain and saving to disk mutually exclusive?

I want to save a current user of my application, but I'm a bit confused on how I choose between what's necessary for the keychain and what should be saved to disk or even if both or just one should be used. 我想保存我的应用程序的当前用户,但是我对如何选择钥匙串所需的内容和应该保存到磁盘的内容,或者即使同时使用或仅使用两者之间的选择感到有些困惑。

I'm thinking I should save the user's email and password to keychain, then save the user object (comprised of email, password, name, gender, and uuid) to disk (minus the email and password) 我想我应该将用户的电子邮件和密码保存到钥匙串中,然后将用户对象(由电子邮件,密码,名称,性别和uuid组成)保存到磁盘(减去电子邮件和密码)

Is this the correct approach? 这是正确的方法吗? Or should I be doing something else 还是我应该做别的事情

In your case, the data you wish to store is tiny: why not store it all in the keychain? 在您的情况下,您希望存储的数据很小:为什么不将其全部存储在钥匙串中? It won't be more effort, and will in the end prove simpler than storing half on disk and half in the keychain. 无需付出更多努力,最终证明比在磁盘上存储一半在钥匙串中存储要简单。 And if the user has keychain sync activated, you benefit from that for free... 如果用户激活了钥匙串同步功能,则可以免费从中受益...

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

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