文件夹iOS模拟器

Document folder iOS Simulator

如何在使用模拟器时快速找到应用程序的文档文件夹(在mac中)?现在,当我需要在 App 模拟期间探索文档文件夹时,我使用 App 的变量来查找文档文件夹路径,并在调试期间读取路径(使用变量),但我认为这不是最佳解决方案。

打开 Terminal.app 和 运行:

xcrun simctl get_app_container booted [app identifier]

您甚至可以设置一个别名来更改目录,例如:

alias cdmyapp='cd $(xcrun simctl get_app_container booted com.mycompany.myapp)'

在应用程序中设置并命中断点,然后在 Xcode 控制台(变量视图旁边)写入以下内容:

po NSHomeDirectory()

然后在 Finder 中按 Shift+CMD+G,粘贴上面返回的路径(不带引号)并按回车键。

如果您使用的是 ZSH,您可以试试这个脚本。 https://gist.github.com/nickcheng/cbc0717d2c9f79613cf2c042503b5422

我有2个解决方案

  • Simpholders or free and open source alternative OpenSim
  • 一个简单的脚本,用于在 iOS 模拟器
  • 上使用最近启动的应用程序打开查找器 window

deviceId=$(xcrun simctl list devices | grep Booted | sed -n 's/^.([A-F0-9]{8}-([A-F0-9]{4}-){3}[A-F0-9]{12}).$//p') applicationFolder=~/Library/Developer/CoreSimulator/Devices/$deviceId/data/Containers/Data/Application/ applicationFolder=$applicationFolder$(ls -Art $applicationFolder | tail -n 1) open $applicationFolder