简体   繁体   English

找不到 ios 文档的 /var/mobile/applications 目录

[英]can't find /var/mobile/applications directory for ios documents

I'm trying to run a release build on my iPad device connected to xcode for debugging.我正在尝试在连接到 xcode 的 iPad 设备上运行发布版本以进行调试。 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).我不确定但猜测当我这样做时,文档目录最终会在我本地机器上的某个地方而不是在 iPad 上(就像我在没有 xcode 的情况下运行它时一样)。 I get an output like this for the directory:我得到这样的目录输出:

/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.转到 /var 不会显示任何“移动”子目录。 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).这似乎与我在未连接的情况下运行 iPad 并最终通过 xcode 中的管理器在设备上查看文件时有所不同(让我得出结论,当运行连接到 xcode 时,它​​会将它们本地保存在这个神秘的目录中)。

Can someone help me access this mystery directory?有人可以帮我访问这个神秘目录吗?

For "xcode 6" :对于“xcode 6”

  1. Connect your device with your MAC (You can sure about that having a look into the simulator list, it should be there)将您的设备与您的 MAC 连接(您可以确定查看模拟器列表,它应该在那里)
  2. Now open xcode and go to "Windows" from upper menu现在打开 xcode 并从上方菜单转到“Windows”
  3. Go to "Devices" from drop down list从下拉列表中转到“设备”
  4. Now this window will pop up.现在会弹出这个窗口。 Your app should be there in the "Installed Apps" section.您的应用程序应该位于“已安装的应用程序”部分。 Like the picture below.就像下面的图片。 Double click on it.双击它。

    在此处输入图片说明

  5. 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.因为这是 iPhone 设备部分,您可以通过 xcode 访问。

    在此处输入图片说明

  6. 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.它会删除您的照片以及整个项目。

    在此处输入图片说明

Window -> Organizer -> 选择你的Iphone -> Applications -> 选择你的iphone项目名称,你可以在“沙盒中的数据文件”中看到blow

(Original poster here) A few things I got wrong: (原海报在这里)我做错了一些事情:

  1. 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.这个 /var/mobile 目录本质上必须是设备本身上的某个位置,通常无法从 mac 浏览器访问。
  2. 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.我通过分离 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.我不会删除这个问题,而是将这个问题留在这里给其他人和我自己,作为查看/刷新管理器中文件的提示,以及在设备上运行时文件放置位置的说明。

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/

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 给出的

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.如果您碰巧去尝试在计算机上访问它.. 您将无法找到这些文件。

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/>

To see the file saved in iPhone -要查看保存在 iPhone 中的文件 -

  1. Go to plist file of your project.转到项目的 plist 文件。
  2. Set Supports Document Browser to "YES".将支持文档浏览器设置为“是”。
  3. You will see the saved file in FILES in your device.您将在设备的 FILES 中看到保存的文件。

I am using iOS 13 and Xcode 11.6, it worked for me.我正在使用 iOS 13 和 Xcode 11.6,它对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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