saveLocalData, A color?

I’m making a game, where you can buy different colors for your puck(a hockey game) and when I do saveLocalData(“PuckColor”, color(255,0,25)) it gives me this error, (“error: [string “–BgNew…”] 262: Can only save a string or a number or nil.”) So how can I store color() in saveLocalData?

^ that thread is awesome.

I already got the answer, I stored the color as a string for example,

if color = color(255,255,255) then
color = “white”

where is the save destination for saveLocalData?


Disclaimer: I actually have no idea :slight_smile:

In all honesty though, this is the best I’ve found, but you were in this conversation @firewolf so it’s probably nothing you don’t already know

Specifically, this quote from @TechDojo

As an update to this - I found the directory 

After a quick google search I found this link.

And in it this snippet of code

// where are you?
NSLog(@"Documents Directory: %@", [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);
Which if you add to the end of your applicationDidFinishLaunchingWithOptions function - will print out to the log the location (buried deep within ~/Library/CoreSimulator/Devices

Ultimately you'll find that the data is indeed stored within your app's Library/Preferences folder as a .plist file stored in a reverse url style name that matches your app's unique reference.

The plist file contains a single key for your App's name with a dictionary of key / value pairs for each key that you create when using saveLocataData

This probabbly isn’t anything you don’t already know, but hope it helps :slight_smile: