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

dazcox5181

Suspended
Original poster
Jun 12, 2005
342
75
Essex, UK
Hi,

I'm pretty new to iPhone development, but have dabbled in various languages in the past.

I'm trying at present to find an easy way to add a few features to an app for my employer.

We have a network of 300ish stores across UK, and would like to implement a store finder.

I have the view setup with a map view which works, and have added buttons to either find your current location and a search bar to type in the city/town/region and it will add an annotation there.

What I need to do is add in the 300ish store locations. Ideally I'd like to add an accessory view to the callout to include store details such as phone number etc.

This is where I got stuck.

I've got the addresses in a csv file which i've run through the Geocoder at gpsvisualizer.com so I now have the coordinates in the csv, also in this file are the phone numbers etc.

How can I get this data available to my app? (easiest method please!)

I thought I might be able to read in the file, but as it's an iphone app don't know if thats possible.

If i can just get the annotations added I can worry about filtering them later for just the closest ones!

Can anyone help please had a useless afternoon of googling so far on this.
 
As far as reading persistent data on the iPhone, you have several options.

But I'd probably look at the database-related options since it's sounds like your reading from a database, your CSV file.

1) If you have previous database experience, with some SQL knowledge, you can use SQLite to store your data as as SQLite database file and use iPhone SQLite API to read the necessary records. SQLite database is built in the iPhone. Just convert/import your CSV file to SQLite database file. Lots of SQLite and iPhone tutorials out there to help you with this.

2) Alternatively you can use Core Data, which may be easier if you aren't familiar with SQL, and seems to be the preferred method for many. You may choose to go this route as I believe it'll involve less code writing.
 
How can I get this data available to my app? (easiest method please!)

I thought I might be able to read in the file, but as it's an iphone app don't know if thats possible.
Yes, iPhone apps can read files. Probably easiest using of the the various initWithContentsOfFile: instance methods. But you might be better off hosting this file on a remote server that the app retrieves, using something like NSURLConnection. That way you can update / add-to the file without having to update the app.
 
Thanks, thats actually what I ended up doing.

What I want to eventually do will be to cache the file locally, and only update if it changes (rare)

I even got the annotations working with callouts.

The detail view is still an issue, as my app has a tab bar not to sure how to now add the a nav bar too, but thats todays challange and it's working at present with an action sheet.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.