iloalo
iloalo

Reputation: 63

Storing game states and scores in keychain

I am trying to store some strings (scores, lastPlayedLevel, etc) of my game in keychain. Because it is said to be the most safe method. Since I am new to Keychain concept I have problems in understanding probably "very simple" things.

I use SAMKeychain wrapper and I want to set lastPlayedLevel string as below

[SAMKeychain setPassword:@"25" forService:[[NSBundle mainBundle] bundleIdentifier] account:@"lastPlayedLevel"];

Is it a correct approach? I am not sure about the "account" part. I want "lastPlayedLevel" be synced across all devices of the user. Do I have to write a user specific string instead?

Upvotes: 1

Views: 102

Answers (1)

GeneCode
GeneCode

Reputation: 7588

Putting score and game state in keychain is overkill IMHO. What you need to do is just store them in the NSUserDefaults, but encode your data into binary before storing it so anybody opening your NSUSerDefaults file wont be able to view/edit it straight away. If you want more secrecy, then encode the value first (for example char xor or other) before encoding to binary.

Upvotes: 1

Related Questions