我将locationsWOW.sqlite3文件拖放到我的项目中,并尝试将其加载到中。控制台未显示有关NSLog(@"failed to open database!")
的信息;但显示NSLog(@"database open");
即使当我将locationsWOW
的名称更改为位置(@"locations" ofType:@"sqlite3"];)
这是不存在的,仍然项目已成功编译和我的.sqlite数据库不起作用。任何人都可以帮助我一个初学者。如何将my.sqlite3导入到Xcode中的iPhone项目中
这是我的代码。
-(id)init{
if (self = [super init]) {
NSString *sqlite3DB = [[NSBundle mainBundle]pathForResource:@"locationsWOW" ofType:@"sqlite3"];
if (sqlite3_open([sqlite3DB UTF8String], &_database) != SQLITE_OK) {
NSLog(@"failed to open database!");
}
}
NSLog(@"database open");
return self;
}
请提供一些更多的澄清你的问题后。 – himan 2014-10-29 10:46:24