Finding a saved file on the Simulator?

spring picture spring · Mar 15, 2012 · Viewed 22.8k times · Source

I'm using the MusicSequenceFileCreate function to save out a midi file to make sure the data is correct. I'm not getting any errors but I would like to view the saved file but have no idea how to do this.

I know I can try reading it in in iOS but I would like to view it (and test it) on the desktop.

Is this file stored in some Simulator cache that I can access?

Answer

v01pe picture v01pe · Oct 7, 2014

The location changed for Xcode 6 with iOS 8:

~/Library/Developer/CoreSimulator/Devices/DEVICE_UDID/data/Containers/Data/Application/APPLICATION_ID/Documents

DEVICE_UDID: can be found out in the Device Inspector (Window -> Devices) and Select the simulated device you're running on. The field Identifier contains the device's UDID.
You can also get a list of the simulator UDID's by running the command xcrun simctl list (thanks @JeremyHuddlestonSequoia)

APPLICATION_ID: I didn't find this number somewhere, so I looked into the folders until I found what I wanted. If someone finds out where this number comes from, let me know.
EDIT: The ID of the application changes every time you start the simulator, but when you keep a finder window open pointing to that folder, you'll always find yourself in the correct folder (no idea how they do that; every other application seems to loose track of the files), which is extremely handy!