Programmatically Opening the iOS Simulator Data Directory For Your App
When developing an app that downloads data and/or creates a lot of data, it is useful to inspect the simulator's file system to ensure the files are what, and where you expect them to be. I was tired of having to manually dig in and figure out where these files were being installed to, so I wrote an Xcode Run Script to figure it out for me.
Install it as a run script in your Xcode Target like so:
It works by using the
find command to search the iOS Simulator's file system for the product name, then grabs the most recently modified one.
If this run script is added after the copy files script, we can be assured that the most recently modified one is the one we just built.
Once we have the most recent product, we find its root directory (i.e. app folder) then open up its Application Support directory.
You may need to edit the
MOST_RECENT_APP_DATA_DIRECTORY= line to suit the directory structure for your specific project. Enjoy
Lastly, I run a small software company called Urban Apps. It pays the bills so I can take the time to write helpful posts like this one. If you found this page helpful at all, I would really appreciate it if you would check out my Apps on the iTunes App Store.
Was this page helpful for you? Buy me a slice of 🍕 to say thanks!