PureBasic Forum

How can I set the default values for "NSUserDefaults"
Page 1 of 1

Author:  Wolfram [ Wed Jul 17, 2019 11:52 am ]
Post subject:  How can I set the default values for "NSUserDefaults"

How can I detect if the program is running the first time an I have to initialize the default values?

In this example here I can see how to use the "NSUserDefaults standardUserDefaults", but how can I set the standard value if the Preferences file is generated.

In PB it is simple
ReadPreferenceString("myParameter", "standardValue")

Author:  wilbert [ Wed Jul 17, 2019 6:49 pm ]
Post subject:  Re: How can I set the default values for "NSUserDefaults"

The NSUserDefaults class has a method called registerDefaults: that allows you to set default values.
Most examples use a plist file where you put the default values, parse that file and use the resulting dictionary for the registerDefaults: method.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group