Search code examples
objective-cbundlensuserdefaultsstoredocuments

objective c for iOS: where to store pin code locally


I am making an app that asks the user to enter a pin before they can use the app. My question is: where exactly is it appropriate to store such data (so it can be checked if its correct), NSUserDefaults?, a bundled file ?, apps documents folder ?


Solution

  • You should definitely store sensitive data in the Keychain. NSUserDefaults stores its data in a plain text file that anyone can read with access to the filesystem.

    There are a few open-source classes that ease the use of the Keychain API, you should definitely check them out:

    SFHFKeychain access:

    SFHFKeychain