0

I'm new to Core Data and I've set up my project using MagicalRecord:

https://github.com/magicalpanda/MagicalRecord

Which is straight forward for the most part, however, I have need to populate UITableView with an array of states that once clicked on push to a detail view that contains a list of cities that correspond to that state. Since there will be a large number of cities for each state I figured that this would be the best route to go.

So exactly would I fill my model with all of this data?

1 Answers1

1

To figure out how to populate this database, you'll first need to answer a couple questions:

  1. What format is the state/city data in? (csv, json, xml, etc)
  2. Does the app need to be shipped with a prepopulated database, or will the data be populated at some other point?

The answer to the parsing question will tell you what you'll need to do to get the data into the sqlite database

If the database can be prepopulated, I'd write a simple script (ruby/python/perl) to parse and import the data into the database, which I would run as the state/city data is updated.

If the database needs to be populated once the app is opened, or at some other point in the flow of the app, I'd find a third party Objective-C library to handle parsing it for me.

Obviously my answer doesn't give any specifics on how to implement anything, but it should give you a direction to start heading.

teubanks
  • 710
  • 1
  • 5
  • 10