简体   繁体   中英

Document folder iOS Simulator

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.

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

po NSHomeDirectory()

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

Open up Terminal.app and run:

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

I have 2 solution

  • Simpholders or free and open source alternative OpenSim
  • A simple script that opens the finder window with the recently launched application on the iOS simulator

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM