iOS 中是否有等效的 Android 共享首选项来保存凭据(用户名和密码)?

Waq*_*leh 1 passwords cocoa-touch credentials ios

来自Android开发,我使用SharedPreferences存储用户名和密码以使用OutputStreamWriterHttpURLConnection登录到服务器。现在在iOS 中我使用NSMutableURLRequest发送用户名和密码。是否有任何的iOS存储喜欢的用户名和密码SharedPreferences的iOS?请记住,这是敏感数据,因此需要确保安全。

小智 5

就在这里。用户名和密码应该使用 Apples Keychain 保存。Keychain 默认是加密的。 https://developer.apple.com/library/ios/documentation/Security/Conceptual/keychainServConcepts/iPhoneTasks/iPhoneTasks.html

另外,请查看本教程,了解如何在 iOS 中使用钥匙串。 http://maniacdev.com/2011/07/tutorial-how-to-use-the-ios-keychain-to-store-names-and-passwords

要保存其他用户首选项,请使用 NSUserDefaults。