IOS???????????????
???????????? ???????[ 2014/2/18 11:16:41 ] ???????????? ???????
??????????
??????????????????????屻???????????á????????????????????????????????????????????????????????????????????????????
????????????
??????documents???′??????test.sqlite??????????????User??User???username??password????varchar???????Ρ?
?????????:???SQLiteManager???????????????????????????????????????У?????????′???????????documents????
/**
* ??????????????????
*/
-(void)createEditableCopyOfDatabaseIfNeeded
{
// ???ж? sandbox ????? documents ???????????????????????? test.sqlite
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory?? NSUserDomainMask?? YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:@"test.sqlite"];
BOOL ifFind = [fileManager fileExistsAtPath:writableDBPath];
if (ifFind)
{
// NSLog(@"??????????");
return;
}
else{
NSLog(@"?????????????????");
}
// ???????????????????????????????
NSString *defaultDBPath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"sqlite"];
BOOL ifSuccess = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error];
if (!ifSuccess) {
NSLog(@"Failed to create writable database file with message '%@'."?? [error localizedDescription]);
}else {
NSLog(@"createEditableCopyOfDatabaseIfNeeded ????????");
}
return;
}
|
??????

???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44