我无法在文档目录中复制这个sqlite文件:没有复制过......请有人知道我错过了什么吗?谢谢!
BOOL success;
//documents path
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
NSString *dbPath = [documentsDir stringByAppendingPathComponent:@"verbi2.sqlite"];
NSFileManager *fileManager=[NSFileManager defaultManager];
success = [fileManager fileExistsAtPath:dbPath];
if (success) return;
//bundle path
NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"verbi2.sqlite"];
[fileManager copyItemAtPath:databasePathFromApp toPath:dbPath error:nil];
我已经解决了创建一个新的.sqlite文件(verbi5.sqlite)的问题。可能有些东西被腐蚀了。