iOS Programming - JSON

Associate
Joined
25 Feb 2007
Posts
905
Location
Midlands
Hi,

I'm very new to iOS development so apologies if this is vague...

I need to grab a JSON feed and download the contents into a local database.

What sort of database should I use - SQLite or CoreData?

Is there a tutorial that covers this end to end? I can find tutorials covering each different part but was hoping for something more 'complete'!

Thanks!
 
SQLite is in the Core Data framework, There are two options really, an SQLite database for more complex data or plist files for simpler data.

Your best bet to learn SQLite is to get to grips with SQLite on its own first, don't try to incorporate it with an app before you understand how it works.

for paid for tutorials lynda.com has some great stuff. but it is expensive so i would go and purchase a book.

http://www.amazon.co.uk/Using-SQLit...1189/ref=sr_1_1?ie=UTF8&qid=1336145779&sr=8-1

I've heard this book is pretty good.

If you want to use a GUI to create your SQLite db you can purchase Navicat essentials for SQLite on the Mac App Store for £2.99.
 
OK so I've read that Core Data is a bit like a wrapper for SQLite...

It's definitely got to be a SQLite database (over plist files) as the data is quite complex - why would I not use SQLite directly and use CoreData?

I'm familiar with SQL, so I'm wanting to loop through items in my JSON feed (which I've now parsed and is sitting in an NSDictionary) and do things like INSERT INTO etc. but it doesn't seem like it works like that with CoreData?
 
why would I not use SQLite directly and use CoreData?

You don't have to, you can import the libsqlite3.0.dylib and have all of the SQLite functionality. But you can also import the CoreData framework to use some of Apples classes which can add 'features' to manipulate data. It adds functionality to control memory more, or allow you to revert changes in the database etc. It's advanced stuff, i would stay clear of it for now and just use SQLite on its own.

I realised i made a mistake in my first post, i should have said SQLite can work with Core Data, it's been a while since i've used it.

If you haven't imported libsqlite3.0 then it will not work. You need that library.

This might be useful for you, its an iOS project using SQLite. it shows you how to SELECT, INSERT, DELETE and UPDATE.

https://sites.google.com/site/iphonesdktutorials/sourcecode/SQL3.zip?attredirects=0

EDIT* forgot... This tutorial goes with the code

http://www.iphonesdkarticles.com/2008/10/sqlite-tutorial-adding-data.html
 
Last edited:
Back
Top Bottom