簡體   English   中英

文檔文件夾iOS Simulator

[英]Document folder iOS Simulator

當我使用模擬器時,如何快速找到應用程序的文檔文件夾(在mac中)? 現在,當我需要在App的模擬過程中瀏覽文檔文件夾時,我使用App的變量來查找文檔文件夾路徑,並在調試期間讀取路徑(使用變量),但我認為這不是最佳解決方案。

在應用程序中設置並點擊斷點,並在Xcode控制台(Variables View旁邊)中寫下以下內容:

po NSHomeDirectory()

然后在Finder中按Shift + CMD + G,粘貼上面返回的路徑而不使用引號,然后按Enter鍵。

打開Terminal.app並運行:

xcrun simctl get_app_container booted [app identifier]

您甚至可以設置別名來更改目錄,例如:

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

我有2個解決方案

  • Simpholders或免費和開源替代OpenSim
  • 一個簡單的腳本,可以在iOS模擬器上使用最近啟動的應用程序打開查找器窗口

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

如果您使用的是ZSH,則可以嘗試使用此腳本。 https://gist.github.com/nickcheng/cbc0717d2c9f79613cf2c042503b5422

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM