How can I check what is stored in my Core Data Database?

后端 未结 17 2174
北恋
北恋 2020-12-12 14:35

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 try

17条回答
  •  南方客
    南方客 (楼主)
    2020-12-12 14:56

    I found the best way to find and open the .sqlite database is use this script:

    lsof -Fn -p $(pgrep YOUR_APP_NAME_HERE) | grep .sqlite$ | head -n1
    

    For whatever reason, the output on my Mac always has an extra n character, so I had to copy and paste it to open command. Feel free to modify the above command if you've figured out the right command.

    For the best SQLite browser, I'd recommend TablePlus.

    Adopted from: https://lukaszlawicki.pl/how-to-quickly-open-sqlite-database-on-ios-simulator/

提交回复
热议问题