Search code examples
iphonensuserdefaultskeychainstoring-data

Storing datas in keychain


I am doing game for iphone.In that I want to store game data such as level,score,stars count and etc.Shall I use "KeychainItemWrapper" class instead of NSUserDefaults to store those datas."KeychainItemWrapper" class is only used to store username and password only?


Solution

  • I don't see the point in using the keychain for that, it's meant to store passwords/users.

    What's the problem in user NSUserDefaults? Your info is going to be perfectly safe there. Or you can even use CoreData if you want something more "complex".

    In case you want the data to be stored after the users delete the app, then you need to use the keychain to store pairs of key/value. Check this link.

    https://developer.apple.com/library/mac/#documentation/security/Reference/keychainservices/Reference/reference.html