Simple Data Save and Data Load - ParkinT/RubyMotion_Life GitHub Wiki
Using NSUserDefaults you can save and load small sets of data (like User Settings). Just make sure you remember to store plain old strings, hashes and arrays. NSUserDefaults doesn't work well with custom types unless you implement your own NSCoding instructions
class SimpleDataStore
def self.save data
NSUserDefaults.standardUserDefaults["AppData"] = data
end
def self.load
NSUserDefaults.standardUserDefaults["AppData"]
end
end
# Use it like this
data = [
{"key" => "value"}
]
SimpleDataStore.save data
data = SimpleDataStore.load