How to open database sqlite file on iPhone real device? How to open database sqlite file on iPhone real device? sqlite sqlite

How to open database sqlite file on iPhone real device?


Xcode 10.1

In Xcode, go to Window > Devices and Simulators

enter image description here

In the Devices tab, select your application, then click on the Gear icon, then click Download Container...enter image description here

Choose the location you want to save the file, then click on Save.

Go to Finder and find the .xcappdata file you just downloaded, then right click and select Show Package in Contents

enter image description here

The contents folder will open. Your .sql file is in AppData > Library > Application Support

enter image description here

I recommend downloading DB Browser for SQL File, and opening the .sql file with that. It works wonders!


In recent versions of Xcode (8 and up, I think), open this with Window menu --> Devices. Find the device in the device list and look at the installed apps list for the device. Each app that you've built and installed on the device will be listed (and maybe some others). Select your app and click the gear menu below the list. Clicking the "Download" item on the pop-up menu will enable you to copy the app's documents, library, and other directories to your Mac.

NB: This will download an .xcappdata file. Right-clicking on that and selecting "Show Package Contents" will allow you to drill down to the actual sqlite file.


Here's another way:

In debug mode, add a UIActivityViewController to share(copy) your SQLite database to a Mac or to a third party iOS app like SQLiteFlow(iOS), then you can debug your SQLite database.