When it comes to iOS development, almost everyone is familiar with the term Core Data. Being an essential storage mechanism for sensitive data, everyone needs to know how to work with it, whether it comes to storing, filtering, searching or deleting the information. But there are times when you want to actually see the data that has been stored. This can be done easily by SQLPro for SQLite Read-Only, a sqlite database reader in iOS that is available in the iTunes store for free. It is only for readable purpose.
PS. For editing purposes you can also refer to SQLPro for SQLite. It will cost you a few of those hard earned bucks š
In this blog we will show you how to check the data that is being stored in a .sqlite file.
Before starting, you are going to need a project that has core data implemented in it. If you donāt have one, you can download this sample project.
Open your Xcode project and run it on your simulator(at least once) so that some data gets stored in the database.
Now download the SQLPro for SQLite Read-Only from app store.
Open the SQLPro. After you open it you will see something like this
Basically, it prompts you to open the sqlite file whose data you want to view.
For finding the file, open āterminalā and type in the following command
find ~ -name YourProject.sqlite
As soon as you press enter, it will print the path for required file, in a matter of seconds.
Now click on āOpen Otherā option on SQLPro window. After that go to āfinderā window and press Cmd+Shift+G and in the Go field. You will get a path which you need to paste in the field. Press enter and you will be redirected to your sqlite file.
Now open the .sqlite file and you will see SQLPro window like in below image(in case you are running my sample project)
In the tables section you will see 4 options :
If you click on any of the core data models you will get to see their various fields. The fields with name Z_PK, Z_ENT, Z_OPT are ones that we will not be emphasizing on for now. What we really need to care about are the fields that we have already been working on. In our case those fields are ZDATE for ZDATE model and ZLATITUDE, ZLONGITUDE and ZLOCATIONFORDATE for ZLOCATION model.
See the below image for reference.
ZLOCATION Model
ZDATE Model
Now, in the SQLPro window above you will see an another option called Data, situated just beside Schema.
Clicking on this option will let you see the data that has been stored in the database, till now. It will look somewhat similar to this.
ZLOCATION Data
ZDATE Data
This is it. Hope the blog was easy to understand and implement.
Feel free to comment if you face any problems or have any suggestions for improvement.