我正在编写一个应用程序,它使用CoreData使用NSPersistentContainer保存数据。
在开发应用程序时,我想:
我假设数据是物理存储在某处的,但我不知道该在哪里查找。
发布于 2020-09-15 08:06:21
默认情况下,NSPersistentContainer将数据库存储在Libray/Application Support目录下的app容器中。

要定位完整路径,可以在模拟器中使用默认的applicationSupportDirectory的urls(for:in:)函数打印FileManager。
print(FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first?.path ?? "nil")如果您在实际设备上运行应用程序,可以按照这答案下载应用程序容器。
对于沙箱应用程序,位置如下:
~/Library/Containers/…/Data/Library/Application Support/…https://stackoverflow.com/questions/63895810
复制相似问题