views:

109

answers:

4

I am new to iPhone development and want to know which database you use to program an iPhone/iPad?

I have heard its SQLite, are there any alternatives to this?

The application I am programming is like an online shop however you can't buy products, only view their details.

+5  A: 

You should use CoreData for that. CoreData is a database abstraction layer which uses SQLite to store your data. Or you could use SQLite directly. But I would prefer CoreData.

Core Data Programming Guide

Core Data Overview

V1ru8
Core Data is the correct answer. Unless you have a very good reason to use SQLite, Core Data should always be your first choice.
kubi
A: 

SQLite is the master choice here!

As an alternative, I would suggest you the simplicity of an XML file.

Pierre 303
A: 

You can also use NSUserDefaults if u have less data to be stored in your database.

http://icodeblog.com/2008/10/03/iphone-programming-tutorial-savingretrieving-data-using-nsuserdefaults/

If the data to be stored is more then go for sqlite

Pras
`NSUserDefaults` is a great choice if you just want to have a few items persist and you don't need the full power of a database. If you do need database-like persistent storage, you should use Core Data.
kubi
Don't do this. `NSUserDefaults` is for user prefs. It's tempting to use it for everything because it's so transparent and auto-savey, but it's a misuse of it to put app data in there. Learning to interface with SQLite or to use Core Data will pay back handsomely in the long term.
Dan Ray
A: 

If you have any plan to use the database file outside iPhone e.g. in other computer, or data input program to populate data, then SQlite is the best choice. CoreData modify the fields name when you create the database inside XCode. But if the data is only accessed by your app in the iPhone, best choice is CoreData. If you want to run complex sql query then sqlite is better. Read about NSPredicate, what type of query you can do there.

karim