Difference between Keychain and NSUserDefault?

Ganapathy picture Ganapathy · Aug 23, 2012 · Viewed 7.4k times · Source

I am new to objective C, I have created one application in that I have used both NSUserDefault and Keychain to store my user name and password. But I cant differentiate both. Please help to differentiate the both.

Thank you.

Answer

Aravindhan picture Aravindhan · Aug 23, 2012

A keychain is an encrypted container that holds passwords for multiple applications and secure services. Apple Inc. uses keychains as password management system in Mac OS and iOS.

NSUserDefaults Provides a way for application behavior customization based on user preferences. Belongs to the Foundation framework for Cocoa and Cocoa Touch.

I got this from Tag Information of NSUserdefaults and keychain