NSUserDefaults或keychain最好在iPhone应用程序中保存用户名和密码 [英] NSUserDefaults or keychain is better to save username and password in iPhone app

查看:274
本文介绍了NSUserDefaults或keychain最好在iPhone应用程序中保存用户名和密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iphone应用中,有一些机密数据,如用户名,密码和网络服务的一些网址。
哪一个更好NSUserdefaults或钥匙串。
有人说NSUserdefaults不安全。为什么不安全?
,任何人都可以给出每个人的利弊。

In my iphone app there is some confidential data like username, password and some urls to a webservice. Which one is better NSUserdefaults or keychain. Somebody says NSUserdefaults is insecure. Why it is insecure? and can any one give the pros and cons of each one.

推荐答案

NSUserDefaults非常易于使用和存储每个键只有一个值。但显然,它不是一种非常安全的方法,因为没有加密。

NSUserDefaults is quite easy to use and stores one value per key only. But apparently, it is not a very secure method, as there is no encryption.

但是Keychain是安全的,虽然它有点难以编码。
您可以参考这些链接以使用钥匙串访问。

But the Keychain is secure, though it is a bit hard to code. You can refer these link to use keychain access.

http://log.scifihifi.com/post/55837387/simple-iphone-keychain-code

你也可以使用这个由Simon设计的库

you can also use this library deviced by Simon

https://github.com/goosoftware/GSKeychain

我希望它可以帮到你!!

I hope it helps you!!

这篇关于NSUserDefaults或keychain最好在iPhone应用程序中保存用户名和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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