Sqlite 文件位置核心数据 [英] Sqlite File Location Core Data
问题描述
通常,核心数据应用程序的 sqlite 存储文件位于
Typically, the sqlite store file for core data apps is located in
Library>Application Support>iPhone Simulator>7.1(或您使用的任何版本)>Applications>(包含您的应用程序的文件夹)>Documents
Library>Application Support>iPhone Simulator>7.1(or whichever version you are using)>Applications>(Whichever folder contains your app)>Documents
文件夹,但我在 IOS 8 中找不到它.我假设他们只会在 iPhone Simulator 文件夹中添加一个 8.0 文件夹,但它不存在.有人能找到吗?
folder, but I can't find it in IOS 8. I would assume they would just add an 8.0 folder inside the iPhone Simulator folder, but it's not there. Has anybody been able to locate it?
推荐答案
我设法找到了 sqlite 文件,现在它在这个路径中:
I managed to locate the sqlite file, and its in this path now:
Library/Developer/CoreSimulator/Devices/(数字和字母)/data/Containers/Data/Application/(数字和字母)/Documents/
Library/Developer/CoreSimulator/Devices/(numbers and letters)/data/Containers/Data/Application/(numbers and letters)/Documents/
(数字和字母)代表您的应用程序/计算机独有的文件夹,但看起来像这样:779AE2245-F8W2-57A9-8C6D-98643B1CF01A
(numbers and letters) stands for a folder that would be unique to your app/computer, but would look like this: 779AE2245-F8W2-57A9-8C6D-98643B1CF01A
我可以通过进入 appDelegate.m 找到它,向下滚动到
I was able to find it by going into appDelegate.m, scrolling down to the
- (NSURL *)applicationDocumentsDirectory
方法,和NSLogging返回路径,像这样:
method, and NSLogging the return path, like this:
// Returns the URL to the application's Documents directory.
- (NSURL *)applicationDocumentsDirectory
{
NSLog(@"%@",[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
这将为您提供独特的路径,让您更轻松,因为使用 2 个未命名的文件夹/字母和数字字符串定位它很棘手.
This will give you your unique path, making it easier for you, because it is tricky locating it with the 2 unnamed folders/strings of letters and numbers.
Swift 4.2:
let paths = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)
print(paths[0])
这篇关于Sqlite 文件位置核心数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!