Is it possible to save an integer array using NSUserDefaults on the iPhone? I have an array declared in my .h file as: int playfield[9][11] that gets filled with integers from a file and determines the layout of a game playfield. I want to be able to have several save slots where users can save their games. If I do:
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; [prefs setObject: playfield forKey: @'slot1Save'];
I get a pointer error. If it’s possible to save an integer array, what’s the best way to do so and then retrieve it later?
Thanks in advance!
You can save and retrieve the array with a NSData wrapper
ie (w/o error handling)
Save
Load