问题
Where is my app document folder in Xcode 9 simulator? I tried the old answers for Xcode 8, it's not there. And why Apple makes it so difficult to see the sandbox of our apps in simulator?
回答1:
I found it in the following path.
~/Library/Developer/CoreSimulator/Devices/(SIMULATORID)/data/Containers/Data/Application/(APPLICATIONID)
You can also look into this application for more details.
List of simulator devices can be found in the below path:
~/Library/Developer/CoreSimulator/Devices/
Below file has simulator information:
~/Library/Developer/CoreSimulator/Devices/{UUID}/device.plist
回答2:
simctl
is the officially supported tool to do what you want. It can create, delete, and reboot devices. It can also install, uninstall, and launch applications.
xcrun simctl get_app_container booted <BundleID> data
will get the path to the data container for the given BundleID.
To see full help for the command run xcrun simctl help get_app_container
.
回答3:
For Xcode version 10.2 it is
/Users/{username}/Library/Developer/CoreSimulator/Devices/{simulator ID}/data/Containers/Bundle/Application/{simulator ID}/yourapp.app
回答4:
I will suggest you to print the file path when you get the document directory like below
let dirPathNoScheme = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as String
print(dirPathNoScheme)// then you can just control + shift + G or Go->Go to Folder and paste "~/Library/Developer/CoreSimulator/Devices/53AS028-BBE4-40D3-BC1A-60C2DSDFE0B3/data/Containers/Data/Application/A94SERF7-9191-4B1D-AAA5-BASFE654ED78/Documents"
That's it😊
来源:https://stackoverflow.com/questions/47950238/where-is-my-app-document-folder-in-xcode-9-simulator