3

Where do you store app configurations constants (not user preferences)?

  • store in Info.plist?
  • store in SomeOther.plist?
  • store as static (extern?) constant in a .h?
  • store as #define somewhere? (where?)

Thanks.

Henry
  • 32,689
  • 19
  • 120
  • 221

4 Answers4

4

I do it in a very oldskool C way. I have just a file like Constants.h where I go

#define SOMETHING value

And then I just #include "Constants.h" in my code and use SOMETHING.

Jaanus
  • 17,688
  • 15
  • 65
  • 110
0

I store instance constants as a static in implementation class. Never had a global constant but I guess I would place it in the App delegate.

Rudiger
  • 6,749
  • 13
  • 51
  • 102
0

If they don't have to be preserved after the application is being closed AppDelegate is fine. if they have to, then use NSUserDefaults class ;)

nacho4d
  • 43,720
  • 45
  • 157
  • 240
-2

Save them in NSUserDefaults. Here is a good example:

http://icodeblog.com/2008/10/03/iphone-programming-tutorial-savingretrieving-data-using-nsuserdefaults/

Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556