Prabal Dey
Prabal Dey

Reputation: 31

How to get Core data sqlite file location

I am trying to find the sqlite file location created by core data. I am using the below code:

print("Documents Directory: ", FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last ?? "Not Found!")

And it's showing me the result: ile:///var/mobile/Containers/Data/Application/148690BC-21F4-4239-99B2-5F947023B414/Library/Application Support

But I can't find any sqlite file in the location.

Can any one please help me to solve the issue. I am using Swift 4 and testing my code in iPhone 6sPlus

Upvotes: 3

Views: 2301

Answers (1)

Jerry Krinock
Jerry Krinock

Reputation: 5020

Unless your app is document-based, the default location for your app's sqlite database is its Application Support directory, not Documents. Change .documentDirectory to .applicationSupportDirectory.

Upvotes: 1

Related Questions