Add an SQLite database to an iPhone app

2020-01-25 15:52发布

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

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

7条回答
做个烂人
2楼-- · 2020-01-25 16:26

If you use Firefox, there's this handy addon that you can use to manage and create an SQLite database.

查看更多
霸刀☆藐视天下
3楼-- · 2020-01-25 16:32

I'd also recommend looking at FMDB. It makes using SQLite slightly more Objective-C/Cocoa-like. It's not a full ORM wrapper or anything though; it just wraps the C API into something a bit more flavoursome.

查看更多
祖国的老花朵
4楼-- · 2020-01-25 16:32

http://sqlite.org/docs.html is a good place to start.

You might get more useful help if you are more specific about what you are trying to do, and what obstacles you are encountering.

查看更多
太酷不给撩
5楼-- · 2020-01-25 16:33

CoreData should help, but I can't find it anywhere in the list of importable Frameworks.

You could take a peek at the iPhone examples, especially the SQLite Book List example.

查看更多
三岁会撩人
6楼-- · 2020-01-25 16:38

There is lots of information on the web.

Have you looked at the demo application? SQLite Book List This shows examples of common database functions under SQLite. This is effectively using the standard SQLite C APIs.

There are Objective C wrappers which may suite you more. EntropyDB, SQLitePersistenceObjects and FMDB.

I found this Tutorial and this list of resources which may help.

Recently I've been using an ORM SQLite.net It is the way to go for me but then I'm developing in MonoTouch C#.

Tony

查看更多
乱世女痞
7楼-- · 2020-01-25 16:38

you will have to link in the framework to interact with the database. This can be found under you current iPhone SDK folder.

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/lib/libsqlite3.0.dylib
查看更多
登录 后发表回答