0

I've read many post on how to locate the data store, but am still unable to find it.

I'm printing the location of the Container when I create my Persistent Container:

lazy var persistentContainer: NSPersistentContainer = {
        let container = NSPersistentContainer(name: "DataModel")
        container.loadPersistentStores(completionHandler: {
            storeDescription, error in
            if let error = error {
                fatalError("Could load data store: \(error)")
            }
        })
        print(container.persistentStoreDescriptions)**
        return container
    }()

The output is as follows:

[<NSPersistentStoreDescription: 0x174245190> (type: SQLite, url: file:///var/mobile/Containers/Data/Application/CF77409C-0CD7-4F4F-B657-831E4FA4544B/Library/Application%20Support/DataModel.sqlite)]

I find the Mac file system very confusing. When I go to finder and select Go -> Go to folder... What do I paste as the path?

Thanks.

Martin Muldoon
  • 3,010
  • 4
  • 20
  • 45
  • /var/mobile/Containers/Data/Application/CF77409C-0CD7-4F4F-B657-831E4FA4544B/Library/Application Support/ – shallowThought May 03 '17 at 13:36
  • Hey shallowThought, Thanks but I've done that and I brought to the var directory just under the Macintosh HD... which I guess is the drive itself. What am I doing wrong here? Thanks! – Martin Muldoon May 03 '17 at 13:39
  • Yes. I thought you are on the simulator. You can not reach the device using Finder's GO feature. [This](http://stackoverflow.com/a/43402673/1457385) might help. – shallowThought May 03 '17 at 13:40
  • Could you expound on that please? All of the Project files are stored on the Mac. Where else would they be. Not sure what you mean. – Martin Muldoon May 03 '17 at 13:44
  • Please add tag(s) for your target system (iOS, macOS ...). – shallowThought May 03 '17 at 13:45
  • Sorry.. iOS. Will add tag now. – Martin Muldoon May 03 '17 at 13:47
  • 1
    As you are developing for iOS, the .sqlite file is either in the simulators directory (default "Documents" dir) or on the device. Your path looks like you are on a real device. You can not reach a (non-jailbroken) device through Finder. You can down(and up)load data from the device through Xcode: http://stackoverflow.com/a/26007804/1457385 – shallowThought May 03 '17 at 13:53

0 Answers0