Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

Questions regarding system.setPreference( )
Started by bjoern Aug 22 2018 04:03 AM

1 reply to this topic
This topic has been archived. This means that you cannot reply to this topic.
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Enthusiast

  • 76 posts
  • Corona SDK



I have some questions regarding the Corona functions system.setPreference( ) / system.getPreference( ):

  • Is there some kind of caching mechasim, or does system.getPreference( ) always read from file?
  • Where/How is the data stored on iOS (e.g. NSUserDefaults, file in DocumentsDirectory, ...)?
  • Does system.getPreference( ) have some mechanisms to ensure data is actually written? (Compared to using Rob's loadsave method, where e.g. file could be nil, or file:write (contents) could fail, in which cases the data would not saved and would be lost.)

Best regards!

[TOPIC: post.html]

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,471 posts
  • Enterprise

The system.*Preference() API's use whatever technology is available from the platform. For instance, on iOS and macOS, they are stored in Property List (plist) files, which are binary key-value pair files on a per-app basis using NSUserDefaults. On Windows, an SQLite database is used, though apps can be configured to use the Windows Registry.  


Some of your answers might be answered here:  https://coronalabs.com/blog/2016/09/21/introducing-new-preference-storage-features/