sqlite文件在Mac上存储在哪里?

我在我的Xcode 6.6.1应用程序中链接了libsqlite3.dylib。 我没有使用核心数据,我正在使用FMDB。 我在哪里可以find运行应用程序时创build的.db或.sqlite文件?

我使用Mac很新,但我相信我使用Finder在我的机器上到处search,找不到任何* .db或* .sqlite文件。 当我运行应用程序,它保留执行之间的数据,所以我知道它被保存在某处…但在哪里?

首先得到你的SQLite的path如下代码。

-(NSString*)getDBPath { NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentdirectory = [path objectAtIndex:0]; return [documentdirectory stringByAppendingPathComponent:@"wordDatabase.sqlite"]; } -(void)copyDatabaseIfNeeded{ NSFileManager *filemanager = [NSFileManager defaultManager]; NSError *error; NSString *DBPath = [self getDBPath]; NSLog(@"Path == %@",DBPath); BOOL success = [filemanager fileExistsAtPath:DBPath]; if (!success) { NSString *defaultDBPath = [[[NSBundle mainBundle]resourcePath]stringByAppendingPathComponent:@"wordDatabase.sqlite"]; success = [filemanager copyItemAtPath:defaultDBPath toPath:DBPath error:&error]; if (!success) { NSLog(@"Error in creating database"); } } } 

YourParh: /Users/mspsys087/Library/Developer/CoreSimulator/Devices/AAECF3F8-1EFD-46D6-8B45-08A6BCE7A002/data/Documents/wordDatabase.sqlite

现在find了:

在这里输入图像说明

并在GO中粘贴你的path:

在这里输入图像说明

点击GO,然后点击你的数据库的显示位置。

在这里输入图像说明