1

I have a UITableView with some login form and I manually wrote the configuration values of the UITextFields in this NSArray as NSDictionaries. It is bothering because it's data in the code. I don't want data in my code! And I think that nobody wants that.

Have you ever been in this situation? How would you dispose properly of this data?

I'm going to move it to a plist but I'm not sure is the right solution.

gurghet
  • 7,591
  • 4
  • 36
  • 63

3 Answers3

1

A plist is ideal for storing this kind of data. NSArray even includes support for loading straight out of the file.

Chuck
  • 234,037
  • 30
  • 302
  • 389
  • Yeah but it has a few shortcomings, like you can't use constants just numbers... it's confusing! – gurghet Oct 12 '10 at 21:16
1

Another options is to store the information in an SQLite database, which you can then access using FMDB (http://github.com/ccgus/fmdb).

Abhi
  • 1,117
  • 2
  • 10
  • 15
1

We do things like this using JSON. The very nice SBJson library does all the heavy lifting. You can load the JSON from file directly into a dictionary. Support for strings, numbers, arrays etc... A bit more handy than SQLite, and more flexible than plists.

Daniel Blezek
  • 4,539
  • 1
  • 19
  • 20
  • That sounds nice, I already use JSON for server communication. But where to store this information? – gurghet Oct 13 '10 at 00:18