Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

LT21j

macrumors newbie
Original poster
Apr 8, 2013
11
0
I'm in the process of making an app where a have a bunch of information about teachers on a file
example:
Mr. Mathman
Math Department
Classes Taught: Algebra II, Honors Pre-Calculus
Free Periods: 1A, 4B
Contact: email@school.org
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?
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
Depends.

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.
 

LT21j

macrumors newbie
Original poster
Apr 8, 2013
11
0
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.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
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.
 

Duncan C

macrumors 6502a
Jan 21, 2008
853
0
Northern Virginia
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.

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.
 

MattInOz

macrumors 68030
Jan 19, 2006
2,760
0
Sydney
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.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,561
6,059
I'm a big fan of using XML files on the iPhone. NSXMLParser makes reading them pretty easy.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.