Questions regarding system.setPreference( )

Hello,

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!

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/

Rob

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/

Rob