LKDBHelper 在模拟器中可以任意指定db目录,但在真机中不行,必须在Documents目录下。
//重载选择 使用的LKDBHelper
+(LKDBHelper *)getUsingLKDBHelper
{
static LKDBHelper* db;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSString* dbpath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/user.db"];
db = [[LKDBHelper alloc]initWithDBPath:dbpath];
//or
// db = [[LKDBHelper alloc]init];
});
return db;
}
Path: /var/mobile/Containers/Data/Application/204AF76C-*********-B2F8-E6F0CE7464B7/Documents/user.db