开发者

Xcode SQLite - no such table

I have a database located in the Resource folder. This is how I 开发者_开发百科open the database:


NSString* path = [[NSBundle mainBundle] pathForResource:@"dotdDB" ofType:@"sqlite"];
if (sqlite3_open(path, &_database) != SQLITE_OK) {

I know that sqlite3_open command creates a new database if it can't find it so that's why I get "no such table"

I've tried to uninstall the app and reset the simulator but still no success. Any suggestions why I can't find my database in the simulator?

*I use Xcode 3 & sqlite3


Try this:

sqlite3_open([path UTF8String], &_database)


I can recommend using fmdb library to interact with sqlite. IMHO, it makes the db operations pretty painless.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜