Tags

An excellent day of coding today as I spent the day hooking up the database storage to the iPhone.  This was all new to me but there’s some good documentation out there.  I used some sample code from Bill Dudney and Chris Adamson’s book “iPhone SDK Development” so I could get used to using SQLite (cos I’m a MySQL kinda guy).The most useful thing I learned today….. the way that the SDK will copy the SQLite database to a WHOLE new place.  Turns out the insert code was working fine I just didn’t know where it was going.

NSArray *searchPaths =

NSSearchPathForDirectoriesInDomains

(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *documentFolderPath = [searchPaths objectAtIndex: 0];

dbFilePath = [documentFolderPath stringByAppendingPathComponent:

DATABASE_FILE_NAME];

NSLog(documentFolderPath); is your friend.So it’s all coming along nicely, the first commit went up to github this afternoon so other people can have a play with it (assuming that you’re all bored with the snow now).  The next job is to bundle up the saved locations and send them to a server (somewhere to be decided).  There’s plenty of resources on getting an iPhone app to pull JSON data in from a URL but not a lot about transmitting it.  This is going to be fun 🙂

Advertisements