在 iPhone 应用程序中存储密码 [英] Storing passwords in iPhone applications

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

问题描述

I have a simple application, based of the "Utility Application" template. It retrieves a password-protected XML file (via NSXMLParser).

I want to allow the user to set a username and password in the "FlipsideView", how would I go about this?

I have the basics in place, the two UITextField boxes, the value of which gets set to a fixed value when the view loads (using the viewWillAppear method), and NSLog'd when the view is closed (the NSLog is just for testing, obviously, in the viewWillDisappear method)

How do I store the data? I've had a look at the Developer documentation, and it seems like I should be using NSUserDefaults..?

解决方案

I agree with Ben. This is exactly what the Keychain is for.

I would not, under any circumstances simply store passwords in the defaults as dbr suggests. This is highly insecure. You're essentially storing your passwords in the open.

In addition to Apple's sample code, I also recommend Buzz Anderson's Keychain code: iPhone Keychain Code

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

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