Help with iphone data/files

Discussion in 'iOS Programming' started by LT21j, Apr 8, 2013.

  1. LT21j macrumors newbie

    Apr 8, 2013
    I'm in the process of making an app where a have a bunch of information about teachers on a file
    Mr. Mathman
    Math Department
    Classes Taught: Algebra II, Honors Pre-Calculus
    Free Periods: 1A, 4B
    Fun Fact: I have a dog

    What I want to do is have the app scroll through the file and find the teacher I send into the method, and read the information and send it to the view where I will have a bunch of text fields. What's the best way to store the file and read it?
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008

    How many records? Are the records editable? How will you update the app with new data? What iOS technologies do you know or are willing to learn?

    Choices include: plain text file, CSV file, plist file, sqlite db, core data.
  3. LT21j thread starter macrumors newbie

    Apr 8, 2013
    I know how to use Xcode basic stuff, like coco, storyboard, etc......I have never used core data. But I do know a few other languages java, basic, c++, objective c, so I'm decently familiar with programing concepts. I'm willing to learn whatever it takes to get the app finished. As for your first few questions, there are about 25-30 entries total on the one .txt file I have. I was hoping that the only way the file would change is by updating it through the App Store update feature other than that it wouldn't be editable.
  4. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    For a modest amount of data that doesn't change I would use a plist file. You'll create the plist file and include it in the app bundle. The app can then read it and display the contents.

    You can create and edit the plist file in Xcode "by hand" or you can create it in code and save it.
  5. Duncan C macrumors 6502a

    Duncan C

    Jan 21, 2008
    Northern Virginia
    Heck, for 20 or 30 records, you could even use a tab-delimited text file, and read that at startup. If you've already written code to parse a text file, that would represent the least amount of changes.

    Pros: Dirt-simple to create the file.

    Cons: Processing overhead will become an issue if your file gets bigger; string parsing code is a bit of a pain to write; data format is not very flexible if you want to add/remove/reorder fields; Can go badly wrong if there are formatting problems in your text file.
  6. MattInOz macrumors 68030


    Jan 19, 2006
    If your going to use just CVS text file why not stick with a standard like vCard for tagging. Then you can just use Address book to create the file.

    You could even just use a private Addressbook and Use the Addressbook API views for navigation.
  7. ArtOfWarfare macrumors G3


    Nov 26, 2007
    I'm a big fan of using XML files on the iPhone. NSXMLParser makes reading them pretty easy.
  8. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    And I'm a big fan of using JSON files. NSJSONSerialization makes reading them even easier. :D

Share This Page