I am making an app that relies on Core Data. I am able to enter data into a text field and store it.
But I need to know if the data is being stored.
I am trying to make a detailView to my tableView and I am not getting any results. Now I am wondering is that because I am doing something wrong with my code, or is the data nto being stored properly.
How can I see what is stored in the app's CoreData database?
The persistent store should be located in the AppData > Library > Application Support directory. In this example you should see a SQLite database with extension . sqlite. It is possible that you don't see the persistent store in the Application Support directory.
The persistence part of Core Data is backed by SQLite, which is a relational database.
Here is my solution(works on iOS 9):
I use an automator/bash script that open the database in sqllitebrowser. the script finds the latest installed app in the simulator. Instructions:
cd ~/Library/Developer/CoreSimulator/Devices/ cd `ls -t | head -n 1`/data/Containers/Data/Application cd `ls -t | head -n 1`/Documents open -a DB\ Browser\ for\ SQLite ./YOUR_DATABASE_NAME.sqlite
Swift 4, 5
Add this line in AppDelegate
>> didFinishLaunchingWithOptions
function:
print("Documents Directory: ", FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last ?? "Not Found!")
Your modelName.sqlite
file will be there.
You can open it with any SQLite browser tools like http://sqlitebrowser.org/ that is free.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With