Xcode模拟器中的应用内容文件夹在哪里?

Where is the app content folder in the simulator of Xcode?

Xcode 9.x 及更高版本的模拟器中的应用程序内容文件夹在哪里?

我在下面的路径找到了

~/Library/Developer/CoreSimulator/Devices/(SIMULATORID)/data/Containers/Data/Application/(APPLICATIONID)

您还可以查看 this 申请了解更多详情。

模拟器设备列表可在以下路径中找到:

~/Library/Developer/CoreSimulator/Devices/

以下文件有模拟器信息:

~/Library/Developer/CoreSimulator/Devices/{UUID}/device.plist

simctl 是官方支持的工具,可以做你想做的事。它可以创建、删除和重启设备。它还可以安装、卸载和启动应用程序。

xcrun simctl get_app_container booted <BundleID> data 将获取给定 BundleID 的数据容器路径。

您可以使用 dataapp,group 作为容器类型。使用 group 时传递组容器 ID 而不是 Bundle ID。如果您不指定容器类型,您将获得应用程序包容器(出于历史兼容性原因)。

查看命令 运行 xcrun simctl help get_app_container.

的完整帮助

我会建议你在得到如下文档目录时打印文件路径

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);

就是这样