0

I check other questions in the stack overflow, however, the problem is I really download some sqliteBrowser, and can not find my project sqlite. Somebody told me that the path is "/Users/My_Name/Libray/Developer/CoreSimulator/Devices".

I find some many folders in the Devices, but which one is my project belongs to? All the folder's name is like "9EF3A7FD-5F1E-4134-A602-307739CEEE07", I was so confused.

2 Answers 2

2

You can debugPrint the path where the sqlite file is created in your AppDelegate if you are using the default template from xcode, you will find the line

let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("Whatever.sqlite") 

put a

debugPrint(url) 

after that and let the simulator tell you where to look.

The directories' names are UUIDs representing the different simulator instances you have been using over time.

Sign up to request clarification or add additional context in comments.

3 Comments

I add "debugPrint(url)" in my AppDelegate, however, I didn't see the output in the console?
My bad; I assumed you were actually using core data. The store is initialized lazily. As soon as you use Core Data features in the app, it should pop up. As a quick workaround, add debugPrint(self.persistentStoreCoordinator) in application:didFinishLaunchingWithOptions:.
Thank you so much! You really solve me my headache problem!!
1

In Swift 3, I add this print statement:

print(container.persistentStoreDescriptions)

inside the lazy declaration of persistentContainer, right before returning the container.

lazy var persistentContainer: NSPersistentContainer = { let container = NSPersistentContainer(name: "App_Name") container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError("Unresolved error \(error), \(error.userInfo)") } }) print(container.persistentStoreDescriptions) return container }() 

Comments