SQLite for iPhone SDK

POSTED BY niklas on Mar 14 under Technology

After asking on the MacRumors forums I was pointed back to FMDB that I had looked at a couple of days ago. FMDB is a Cocoa wrapper for SQLite3. I had a look at it, and after my initial difficulties, I found that I was trying a way to complicated way to use it for my iPhone applications. To add FMDB, simply do the following:

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

12 Comments so far
  1. Josh E March 15, 2008 8:36 am

    Hi Niklas,

    Thanks for the tip!

    I’m particularly interested in accessing the sqlite databases where Apple stores sms messages and call histories. Have any idea’s there?

    Cheers,
    Josh

  2. niklas March 16, 2008 12:07 am

    Sorry, I haven’t looked at accessing the rest of the system, I’m just working within the applications I’m writing at the moment

  3. Oskar March 18, 2008 6:28 am

    I’m quite a newb so thanks for the tips, but after following these steps I get this Xcode error:

    duplicate symbol _main in …/fmdb.o and …/main.o

    I already have a file with a main method, so how do I include FMDB?

  4. Oskar March 18, 2008 6:41 am

    Ah, nevermind, I looked at the source closer and realized that fmdb.o is not part of the actual FMDB wrapper.

  5. Oskar March 18, 2008 6:42 am

    Nevermind, I checked out the source more and realized that fmdb.m is not part of the wrapper itself.

  6. Seb March 27, 2008 4:36 am

    Thanks for posting that info. I have been trying to figure out how to use SQLite on iPhone for a while now. I’ll give it a shot and report back.

  7. Marco Papa June 3, 2008 10:04 am

    The SQLite sample from the beta 5 iPhone SDL uses this frameworrk instead:

    /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib/libsqlite3.0.dylib

    BTW, people that are thinking about accessing other parts of the system implemented as SQLite databases are out of luck. Each iPhone application is limited to its own “sandbox” and that’s it.

  8. steve June 22, 2008 12:36 pm

    Hello.

    I just started with with objective-c/cocoa/iPhone SDK and trying to get the FMDB wrapper working but when I try and compile a fresh project it says:

    error: Cocoa/Cocoa.h not found

    Any help would be greatly appreciated.
    Thanks.

  9. niklas June 23, 2008 1:24 pm

    Make sure you’ve got the Cocoa framework included in your project

  10. icoco August 7, 2008 6:36 am

    hi, how to create a table from iphone ?

  11. Brian Armstrong September 9, 2008 10:04 pm

    I’m getting the same error that Oskar had on March 18, namely:

    duplicate symbol _main in …/fmdb.o and …/main.o

    How do I fix this? I’m using XCode 3.1.

    Thanks,
    Brian

  12. niklas October 8, 2008 10:29 pm

    You seem to have two definitions of the function main(). Try removing one of them

Copyright Niklas Saers, 2000-2008