有没有办法在iOS模拟器上看到文件系统?

时间:2022-08-29 01:55:01

Is there any way to browse the file system of a currently running or just killed iOS simulator? I'd settle for being able to see a specific app's files if there's a way to do that.

有什么方法可以浏览当前正在运行的或刚刚杀死的iOS模拟器的文件系统吗?如果有办法的话,我就满足于能够看到特定应用程序的文件。

Note that I don't want to do this programatically. I want to see/open the files in the Finder.

注意,我不想按程序来做。我想查看/打开查找程序中的文件。

11 个解决方案

#1


185  

UPDATE: Since iOS 8:

更新:因为iOS 8:

~/Library/Developer/CoreSimulator/Devices

~ /图书馆/开发/ CoreSimulator /设备

The location used to be:

地点过去是:

~/Library/Application Support/iPhone Simulator

~ /图书馆/应用支持/ iPhone模拟器

It had directories for all models of simulators (4.0, 4.1, 5.0, etc) you have ever run, go to the one you are running from in Xcode.

它为您运行的所有模拟器(4.0、4.1、5.0等)的所有模型都有目录,请访问您从Xcode中运行的模型。

Once in a folder, go to Applications, choose the Finder option that shows date for files, and sort by date. Your application will be the most recent since it just changed the directory...

进入文件夹后,转到应用程序,选择显示文件日期的查找器选项,并按日期排序。您的应用程序将是最近的,因为它刚刚更改了目录……

Inside the directory is everything related to your application. You can even drop files in there between runs, to revert back to a stored database in a known state for example...

目录中的所有内容都与您的应用程序有关。您甚至可以在运行期间将文件放在其中,以恢复到以已知状态存储的数据库……

I go there often enough I keep the iPhone Simulator directory in my Finder sidebar.

我经常去那里,我把iPhone模拟器目录放在我的查找工具条中。

Note that with iOS8, the simulator folders are in a totally different directory - really split across a few directories, with folder names for application specific files that change each time you run your app.

注意,在iOS8中,模拟器文件夹位于一个完全不同的目录中——实际上是在几个目录之间划分的,特定于应用程序的文件夹名称在每次运行应用程序时都会发生变化。

#2


65  

iOS 8

Devices

~/Library/Developer/CoreSimulator/Devices

Applications

~/Library/Developer/CoreSimulator/Devices/{{Device Code}}/data/Containers/Bundle/

#3


21  

Open the program "Activity Monitor", search for your App (just the apps name, not the simulator), click "Informations" and open "Open files and ports". Copy the second entry (something like /Users/me/Library/Application Support/iPhone Simulator/4.2/Applications/B97A9504-0FA5-4826-BB6D-A2335A676459/VSGradientView.app/YourApp). This is the running app, while <...>/B97A9504-0FA5-4826-BB6D-A2335A676459/VSGradientView.app/ is the bundle, and <...>/B97A9504-0FA5-4826-BB6D-A2335A676459/* the sand-boxed folder.

打开程序“Activity Monitor”,搜索你的App(只是App名称,不是模拟器),点击“Informations”,打开“Open files and ports”。复制第二个条目(比如/Users/me/Library/Application Support/iPhone Simulator/4.2/Applications/ b97a97a9504 - 0fa5 -4826- bb6d - a2335a676459 /VSGradientView.app/YourApp)。这是正在运行的app,而<…>/B97A9504-0FA5-4826-BB6D-A2335A676459/VSGradientView。app/是bundle, <…> / b97a9504 - 0 - fa5 - 4826 bb6d a2335a676459 / *沙箱文件夹。

If you pass this as open "/Users/me/Library/Application Support/iPhone Simulator/4.2/Applications/B97A9504-0FA5-4826-BB6D-A2335A676459/" to the terminal, the folder will open in Finder.

如果您将此文件作为“/Users/me/Library/Application Support/iPhone Simulator/4.2/Applications/ b97a97a9504 - 0fa5 -4826- bb6d - a2335a676459 /”传递到终端,文件夹将在Finder中打开。

Sounds complicated but isn't.

听起来复杂,但不是。

#4


9  

There is a nifty app that also supports the XCode 6 simulator.

还有一个漂亮的应用程序也支持XCode 6模拟器。

https://github.com/somegeekintn/SimDirs

https://github.com/somegeekintn/SimDirs

It is awesome, use it!

太棒了,用吧!

#5


3  

If you want to automate getting the location or use that folder in scripting, you can get the precise location from a running simulator with the following command:

如果您想自动获取位置或在脚本中使用该文件夹,您可以使用以下命令从运行中的模拟器获得精确位置:

xcrun simctl get_app_container booted my.app.id data

#6


3  

based on zsero answer

基于zsero回答

Details

macOS 10.13.1

macOS 10.13.1

Solution

Run the following line in the terminal

在终端中运行以下行

Template

模板

open `xcrun simctl get_app_container booted BUNDLEID_OF_YOUR_APP data` -a Finder

Full Sample

完整的样品

open `xcrun simctl get_app_container booted com.Test data` -a 

BUNDLEID_OF_YOUR_APP ???

BUNDLEID_OF_YOUR_APP = "Bundle Identifier"

BUNDLEID_OF_YOUR_APP = "包标识符”

有没有办法在iOS模拟器上看到文件系统?

Result

有没有办法在iOS模拟器上看到文件系统?

#7


2  

Old post, but I think it is worth mentioning SimPholders to find your Simulator files. It is a menu bar item that tracks your simulator apps and lets you go directly to their folders and content. It's super awesome.

以前的帖子,但是我认为有必要提及SimPholders来找到你的模拟器文件。它是一个菜单栏项目,跟踪你的模拟器应用,让你直接进入他们的文件夹和内容。这是超级棒。

(original answer here: https://*.com/a/26557165/377384)

(原来的答案:https://*.com/a/26557165/377384)

#8


0  

Check answer in this post, Its command to know valid architecture in lib

在这篇文章中检查答案,它的命令知道库中的有效体系结构

https://*.com/a/41705886/1740250

https://*.com/a/41705886/1740250

#9


0  

On Xcode Version 8.2.1 (8C1002) I found the .app files installed on the simulator in this path: ~/Library/Developer/Xcode/DerivedData/[APPNAME]-[RANDOM HASH]/Build/Products/Debug-iphonesimulator

在Xcode版本8.2.1 (8C1002)中,我找到了安装在模拟器上的.app文件,路径为:~/Library/Developer/Xcode/ Xcode/DerivedData/[APPNAME]-[RANDOM HASH]/Build/Products/Debug-iphonesimulator

#10


0  

I write a simple shell script to do that.

为此我编写了一个简单的shell脚本。

https://gist.github.com/BB9z/b913b30c1bca61bfa53d144ecce107f0

https://gist.github.com/BB9z/b913b30c1bca61bfa53d144ecce107f0

Also an Alfred workflow available at https://github.com/BB9z/xcode-config/blob/master/Alfred/Workflows/Xcode%20Directories.alfredworkflow

也可以在https://github.com/BB9z/xcode-config/blob/master/Alfred/Workflows/Xcode%20Directories.alfredworkflow获得阿尔弗雷德工作流

I will keep these updated.

我会更新这些。

#11


0  

Based on @zsero answer, I made a short bash script which directly opens the simulator folder of your application id. Very handy!

基于@zsero的回答,我做了一个简短的bash脚本,它直接打开应用程序id的模拟器文件夹。非常方便!

openappfolder.sh

openappfolder.sh

#!/bin/bash

APPID=$1
if OUTPUT=`xcrun simctl get_app_container booted $APPID data` ; then
    open $OUTPUT
else
    echo "$APPID not found!"
fi 2>/dev/null

Then just

那就

openappfolder.sh com.bundle.id

????

????

#1


185  

UPDATE: Since iOS 8:

更新:因为iOS 8:

~/Library/Developer/CoreSimulator/Devices

~ /图书馆/开发/ CoreSimulator /设备

The location used to be:

地点过去是:

~/Library/Application Support/iPhone Simulator

~ /图书馆/应用支持/ iPhone模拟器

It had directories for all models of simulators (4.0, 4.1, 5.0, etc) you have ever run, go to the one you are running from in Xcode.

它为您运行的所有模拟器(4.0、4.1、5.0等)的所有模型都有目录,请访问您从Xcode中运行的模型。

Once in a folder, go to Applications, choose the Finder option that shows date for files, and sort by date. Your application will be the most recent since it just changed the directory...

进入文件夹后,转到应用程序,选择显示文件日期的查找器选项,并按日期排序。您的应用程序将是最近的,因为它刚刚更改了目录……

Inside the directory is everything related to your application. You can even drop files in there between runs, to revert back to a stored database in a known state for example...

目录中的所有内容都与您的应用程序有关。您甚至可以在运行期间将文件放在其中,以恢复到以已知状态存储的数据库……

I go there often enough I keep the iPhone Simulator directory in my Finder sidebar.

我经常去那里,我把iPhone模拟器目录放在我的查找工具条中。

Note that with iOS8, the simulator folders are in a totally different directory - really split across a few directories, with folder names for application specific files that change each time you run your app.

注意,在iOS8中,模拟器文件夹位于一个完全不同的目录中——实际上是在几个目录之间划分的,特定于应用程序的文件夹名称在每次运行应用程序时都会发生变化。

#2


65  

iOS 8

Devices

~/Library/Developer/CoreSimulator/Devices

Applications

~/Library/Developer/CoreSimulator/Devices/{{Device Code}}/data/Containers/Bundle/

#3


21  

Open the program "Activity Monitor", search for your App (just the apps name, not the simulator), click "Informations" and open "Open files and ports". Copy the second entry (something like /Users/me/Library/Application Support/iPhone Simulator/4.2/Applications/B97A9504-0FA5-4826-BB6D-A2335A676459/VSGradientView.app/YourApp). This is the running app, while <...>/B97A9504-0FA5-4826-BB6D-A2335A676459/VSGradientView.app/ is the bundle, and <...>/B97A9504-0FA5-4826-BB6D-A2335A676459/* the sand-boxed folder.

打开程序“Activity Monitor”,搜索你的App(只是App名称,不是模拟器),点击“Informations”,打开“Open files and ports”。复制第二个条目(比如/Users/me/Library/Application Support/iPhone Simulator/4.2/Applications/ b97a97a9504 - 0fa5 -4826- bb6d - a2335a676459 /VSGradientView.app/YourApp)。这是正在运行的app,而<…>/B97A9504-0FA5-4826-BB6D-A2335A676459/VSGradientView。app/是bundle, <…> / b97a9504 - 0 - fa5 - 4826 bb6d a2335a676459 / *沙箱文件夹。

If you pass this as open "/Users/me/Library/Application Support/iPhone Simulator/4.2/Applications/B97A9504-0FA5-4826-BB6D-A2335A676459/" to the terminal, the folder will open in Finder.

如果您将此文件作为“/Users/me/Library/Application Support/iPhone Simulator/4.2/Applications/ b97a97a9504 - 0fa5 -4826- bb6d - a2335a676459 /”传递到终端,文件夹将在Finder中打开。

Sounds complicated but isn't.

听起来复杂,但不是。

#4


9  

There is a nifty app that also supports the XCode 6 simulator.

还有一个漂亮的应用程序也支持XCode 6模拟器。

https://github.com/somegeekintn/SimDirs

https://github.com/somegeekintn/SimDirs

It is awesome, use it!

太棒了,用吧!

#5


3  

If you want to automate getting the location or use that folder in scripting, you can get the precise location from a running simulator with the following command:

如果您想自动获取位置或在脚本中使用该文件夹,您可以使用以下命令从运行中的模拟器获得精确位置:

xcrun simctl get_app_container booted my.app.id data

#6


3  

based on zsero answer

基于zsero回答

Details

macOS 10.13.1

macOS 10.13.1

Solution

Run the following line in the terminal

在终端中运行以下行

Template

模板

open `xcrun simctl get_app_container booted BUNDLEID_OF_YOUR_APP data` -a Finder

Full Sample

完整的样品

open `xcrun simctl get_app_container booted com.Test data` -a 

BUNDLEID_OF_YOUR_APP ???

BUNDLEID_OF_YOUR_APP = "Bundle Identifier"

BUNDLEID_OF_YOUR_APP = "包标识符”

有没有办法在iOS模拟器上看到文件系统?

Result

有没有办法在iOS模拟器上看到文件系统?

#7


2  

Old post, but I think it is worth mentioning SimPholders to find your Simulator files. It is a menu bar item that tracks your simulator apps and lets you go directly to their folders and content. It's super awesome.

以前的帖子,但是我认为有必要提及SimPholders来找到你的模拟器文件。它是一个菜单栏项目,跟踪你的模拟器应用,让你直接进入他们的文件夹和内容。这是超级棒。

(original answer here: https://*.com/a/26557165/377384)

(原来的答案:https://*.com/a/26557165/377384)

#8


0  

Check answer in this post, Its command to know valid architecture in lib

在这篇文章中检查答案,它的命令知道库中的有效体系结构

https://*.com/a/41705886/1740250

https://*.com/a/41705886/1740250

#9


0  

On Xcode Version 8.2.1 (8C1002) I found the .app files installed on the simulator in this path: ~/Library/Developer/Xcode/DerivedData/[APPNAME]-[RANDOM HASH]/Build/Products/Debug-iphonesimulator

在Xcode版本8.2.1 (8C1002)中,我找到了安装在模拟器上的.app文件,路径为:~/Library/Developer/Xcode/ Xcode/DerivedData/[APPNAME]-[RANDOM HASH]/Build/Products/Debug-iphonesimulator

#10


0  

I write a simple shell script to do that.

为此我编写了一个简单的shell脚本。

https://gist.github.com/BB9z/b913b30c1bca61bfa53d144ecce107f0

https://gist.github.com/BB9z/b913b30c1bca61bfa53d144ecce107f0

Also an Alfred workflow available at https://github.com/BB9z/xcode-config/blob/master/Alfred/Workflows/Xcode%20Directories.alfredworkflow

也可以在https://github.com/BB9z/xcode-config/blob/master/Alfred/Workflows/Xcode%20Directories.alfredworkflow获得阿尔弗雷德工作流

I will keep these updated.

我会更新这些。

#11


0  

Based on @zsero answer, I made a short bash script which directly opens the simulator folder of your application id. Very handy!

基于@zsero的回答,我做了一个简短的bash脚本,它直接打开应用程序id的模拟器文件夹。非常方便!

openappfolder.sh

openappfolder.sh

#!/bin/bash

APPID=$1
if OUTPUT=`xcrun simctl get_app_container booted $APPID data` ; then
    open $OUTPUT
else
    echo "$APPID not found!"
fi 2>/dev/null

Then just

那就

openappfolder.sh com.bundle.id

????

????