4

Where is the app content folder in the simulator of Xcode 9.x and later?

Reza Dehnavi
  • 2,256
  • 3
  • 16
  • 30
GeneCode
  • 7,545
  • 8
  • 50
  • 85

3 Answers3

41

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
Charlie Fish
  • 18,491
  • 19
  • 86
  • 179
33

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.

You can use data, app, and group for the container type. When using group pass the group container ID not the Bundle ID. If you don't specify the kind of container you get the app bundle container (for historical compatibility reasons).

To see full help for the command run xcrun simctl help get_app_container.

russbishop
  • 16,587
  • 7
  • 61
  • 74
  • This gets me the APP container, not the DATA container. – Dale Feb 20 '20 at 00:58
  • 2
    If you look a little closer you will see you need to append `data` to the end of the command to get the data container. The default is the app container for compatibility reasons (because the original implementation only returned the app container). As I noted please see `xcrun simctl help get_app_container` for the full details, including how to get group data containers. – russbishop Feb 28 '20 at 04:50
10

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"

Obj-C:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSLog(@"PATH=%@",paths);

That's it

GeneCode
  • 7,545
  • 8
  • 50
  • 85
Murugan M
  • 175
  • 3
  • 8
  • 2
    This is a heck of a lot faster than clicking through 17 device folders that each have something like 51 app containers! – bugloaf Mar 17 '20 at 18:28