cocoa touch - Add an SQLite database to an iPhone app -


I'm trying to learn SQLite, and I'm building an iPhone app. But I would like to add a SQLite database to my building app. I have three tutorials, but I am not clear on that code.

How can I add the SQLite database to my building app? What does the sample code look like?

First you need to create your own database. From the

  sqlite3 mydb.db  

then create a table in your database

  the table tag (id Int (5), name varchar (255), created dat datetime, updated_at datetime);  

Repeat for any table that you want in your database.

Then you need to include the database file in your project. Add the existing project to your project because you will do any other existing file.

Next you need to link in the framework to interact with the database. It can be found in your current iPhone SDK folder.

/ developer / playfoms / iPhoneOS.platform / developer / SDKs / iPhoneOS2.2.sdk / usr / lib / libsqlite3.0.dylib

end In the header file sqlite3.h you must include

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/include/sqlite3.h

Now it is possible to write the code to access your SQLite database from within your iPhone application.


Comments