Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

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

1 reply to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

bjoern

[GLOBAL: userInfoPane.html]
bjoern
  • Enthusiast

  • 74 posts
  • Corona SDK

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!



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,853 posts
  • Corona Staff

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




[topic_controls]
[/topic_controls]