简体   繁体   中英

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. 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:

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

Can someone help me access this mystery directory?

For "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)
  2. Now open xcode and go to "Windows" from upper menu
  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.

    在此处输入图片说明

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

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/

Thank you they are both right in different contexts

If you are running it on device then what @ethemsulan is correct.

And then on the simulator the folder is found on your mac and the file path is as @Vin and @Osiris has given

To anyone looking out for the exact answer:-

1.Go to plist file of your project.

2.Add one row.

3.Then set the Boolean value of the property "Application supports iTunes file sharing" to "YES"

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.

<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>

To see the file saved in iPhone -

  1. Go to plist file of your project.
  2. Set Supports Document Browser to "YES".
  3. You will see the saved file in FILES in your device.

I am using iOS 13 and Xcode 11.6, it worked for me.

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