0

I need to be able to configure my app via configuration file.
How do I go about it?
The first thing that comes to my mind is having a .plist file that stores values and to have an singleton class and ask that class for values whenever I create element in question in code.

Or is there any better way to do this?

Dvole
  • 5,725
  • 10
  • 54
  • 87

1 Answers1

1

Depends on the amount of content and size of the configuration file. If it's a couple of key-value values, I would just go with NSUserDefaults. If it's a bit more, arrays or more advanced data models, I would go with a .plist. But remember to move the default .plist into the /Documents folder, you are not allowed to edit files in the app bundle.

Finn Larsen
  • 2,201
  • 17
  • 26
  • How do I edit user defaults from external config file? I ended up using a plist. – Dvole May 07 '14 at 15:27
  • NSUserDefault is not a .plist but actually just a user friendly layer that access a locale SQLite database. – Finn Larsen May 08 '14 at 10:55
  • Yeah, but the question is with using extrenal file – Dvole May 08 '14 at 12:19
  • Check this out, says how you put your .plist into the Documents folder and read and write in the .plist: http://stackoverflow.com/questions/9335475/iphone-read-write-plist-file – Finn Larsen May 08 '14 at 12:24