找不到 ios 文档的 /var/mobile/applications 目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9014406/
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
can't find /var/mobile/applications directory for ios documents
提问by Joey
I'm trying to run a release build on my iPad device connected to xcode for debugging. I'm not certain but guessing that when I do this the documents directory ends up somewhere on my local machine and not on the iPad (as when I run it without xcode). I get an output like this for the directory:
我正在尝试在连接到 xcode 的 iPad 设备上运行发布版本以进行调试。我不确定但猜测当我这样做时,文档目录最终会在我本地机器上的某个地方而不是在 iPad 上(就像我在没有 xcode 的情况下运行它时一样)。我得到这样的目录输出:
/var/mobile/Applications/FF0F1AB2-AD1F-4E42-8815-9E399EEF5027/Documents/
/var/mobile/Applications/FF0F1AB2-AD1F-4E42-8815-9E399EEF5027/Documents/
but I can't access that directory. Going to /var does not reveal any 'mobile' subdir. This seems different from when I run the iPad unconnected and end up with files viewable on the device through Organizer within xcode (making me conclude that it saves them locally in this mysterious dir when run connected to xcode).
但我无法访问该目录。转到 /var 不会显示任何“移动”子目录。这似乎与我在未连接的情况下运行 iPad 并最终通过 xcode 中的管理器在设备上查看文件时有所不同(让我得出结论,当运行连接到 xcode 时,它会将它们本地保存在这个神秘的目录中)。
Can someone help me access this mystery directory?
有人可以帮我访问这个神秘目录吗?
回答by Tulon
For "xcode 6":
对于“xcode 6”:
- Connect your device with your MAC (You can sure about that having a look into the simulator list, it should be there)
- Now open xcode and go to "Windows"from upper menu
- Go to "Devices"from drop down list
Now this window will pop up. Your app should be there in the "Installed Apps" section. Like the picture below. Double click on it.
Here you can see the "Documents" folder and the photos you saved earlier. You can't delete photo from this list. Because this is the iPhone device section, you accessing through the xcode.
If you want to delete the photos, you have to delete the whole project. To do that, scroll down below the screen and there should be a minus "-" button. After selecting your project just click on it. It will delete your photos as well as whole project.
- 将您的设备与您的 MAC 连接(您可以确定查看模拟器列表,它应该在那里)
- 现在打开 xcode 并从上方菜单转到“Windows”
- 从下拉列表中转到“设备”
现在会弹出这个窗口。您的应用程序应该位于“已安装的应用程序”部分。就像下面的图片。双击它。
在这里您可以看到“文档”文件夹和您之前保存的照片。您无法从此列表中删除照片。因为这是 iPhone 设备部分,您可以通过 xcode 访问。
如果要删除照片,则必须删除整个项目。为此,向下滚动屏幕下方,应该有一个减号“-”按钮。选择您的项目后,只需单击它。它会删除您的照片以及整个项目。
回答by ethemsulan
Window -> Organizer -> select your's Iphone -> Applications -> select your iphone project name and you can see blow in the "Data files in Sandbox"
Window -> Organizer -> 选择你的Iphone -> Applications -> 选择你的iphone项目名称,你可以在“沙盒中的数据文件”中看到blow
回答by Joey
(Original poster here) A few things I got wrong:
(原海报在这里)我做错了一些事情:
- Running it on the device whether with the debugger or not always puts the file on the device, not on the local drive. This /var/mobile directory must be essentially some location on the device itself that can't normally be accessed browsing from the mac.
- I needed to refresh the view in Organizer to see the files being placed there. I did so by detaching the iPad and then reattaching it (the usb), and the files would refresh.
- 无论是否使用调试器,在设备上运行它总是将文件放在设备上,而不是放在本地驱动器上。这个 /var/mobile 目录本质上必须是设备本身上的某个位置,通常无法从 mac 浏览器访问。
- 我需要刷新管理器中的视图才能看到放置在那里的文件。我通过分离 iPad 然后重新连接它(USB)来做到这一点,文件会刷新。
Instead of removing the question, I'll leave this here for others and myself for the tip in viewing/refreshing files in organizer and the clarification of where the files are being placed when run on the device.
我不会删除这个问题,而是将这个问题留在这里给其他人和我自己,作为查看/刷新管理器中文件的提示,并澄清在设备上运行时文件的放置位置。
回答by Marc Brannan
The directory you are looking for is located at
您要查找的目录位于
/Users/User Name/Library/Application Support/iPhone Simulator/Simulator iOS Version/Applications/Application ID/Documents/
/Users/用户名/Library/Application Support/iPhone Simulator/ Simulator iOS Version/Applications/ Application ID/Documents/
回答by fftoolbar
Thank you they are both right in different contexts
谢谢他们在不同的情况下都是对的
If you are running it on device then what @ethemsulan is correct.
如果您在设备上运行它,那么@ethemsulan 是正确的。
And then on the simulator the folder is found on your mac and the file path is as @Vin and @Osiris has given
然后在模拟器上,在您的 mac 上找到文件夹,文件路径为 @Vin 和 @Osiris 给出的
回答by nagarajan
To anyone looking out for the exact answer:-
对于任何寻找确切答案的人:-
1.Go to plist file of your project.
1.转到项目的plist文件。
2.Add one row.
2.添加一行。
3.Then set the Boolean value of the property "Application supports iTunes file sharing" to "YES"
3.然后将属性“应用程序支持iTunes文件共享”的布尔值设置为“是”
And you are good to go.
你很高兴去。
Also note that you have to plugin the device in order to access the copied files (Programmatically). If you happen to go and try to access it on computer .. you wont be able to find the files.
另请注意,您必须插入设备才能访问复制的文件(以编程方式)。如果您碰巧去尝试在计算机上访问它.. 您将无法找到这些文件。
回答by Iftiquar Ahmed Ove
Add this to your info.plist
source code and you will find the recorded files inside files of iPhone device.
将此添加到您的info.plist
源代码中,您将在 iPhone 设备的文件中找到录制的文件。
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>