Have you ever needed to access the data directory of your iOS app in the simulator? Maybe your app writes to a file and you need to inspect its contents?
Your app's information is stored directly on your Mac. The problem is finding it ... Each different simulator writes to a different path. Each new launch of the simulator creates a different path. Because of this, you can't simply remember the path and go to the same place each time you need to inspect the data.
Thanks to this comment on stackoverflow, I discovered how to find the correct path for the currently open simulator:
xcrun simctl get_app_container booted replace_with_apps_bundle_id data
Running that command in the terminal will tell you the path you need to open.
To save a step, you can also do this:
open $(xcrun simctl get_app_container booted replace_with_apps_bundle_id data)
This command will automatically open the data directory right in your finder.
If you're a React Native developer, you can also add this to your
scripts section like:
open-data: "open $(xcrun simctl get_app_container booted replace_with_apps_bundle_id data)"
Then, in the shell, type
yarn open-data and 💥, Finder will open with the correct path!