xcode 文档文件夹 iOS 模拟器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35963940/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 08:37:55  来源:igfitidea点击:

Document folder iOS Simulator

iosxcodeios-simulatornsfilemanager

提问by Lorenzo

How is possible to find quickly the document folder (in the mac) of an App when I'm using the simulator? When I need to explore the document folder during the simulation of the App now I use a variable of the App to find the document folder path and I read the path during the debug (using a variable) but I think is not the best solution.

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

回答by Johan

Set and hit a breakpoint in the app, and write the following in the Xcode Console (next to the Variables View):

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

po NSHomeDirectory()

Then in Finder hit Shift+CMD+G, paste the path returned above without the quotation marks and hit enter.

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

回答by Jeremy Huddleston Sequoia

Open up Terminal.app and run:

打开 Terminal.app 并运行:

xcrun simctl get_app_container booted [app identifier]

You can even setup an alias to change to the directory, like:

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

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

回答by Tomasz Rejdych

I have 2 solution

我有 2 个解决方案

  • Simpholdersor free and open source alternative OpenSim
  • A simple script that opens the finder window with the recently launched application on the iOS simulator
  • Simpholders或免费和开源的替代OpenSim
  • 一个简单的脚本,用于在 iOS 模拟器上使用最近启动的应用程序打开 finder 窗口

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

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

回答by nickcheng

If you're using ZSH, you could try this script. https://gist.github.com/nickcheng/cbc0717d2c9f79613cf2c042503b5422

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