How do I access files in the iPhone Simulators "Files app"? - ios

I saved a file on the iOS simulator to the Files App. Specifically, I chose to save into "On My iPhone" > Downloads.
Where can I find this file in Finder on macOS?
I found ~/Library/Developer/CoreSimulator/Devices/UUID/data/Downloads but that folder is empty even though when I launch the Files app in my simulator, I clearly see files in the Downloads directory.

I was able to find it by doing a search within the /UUID folder. Apparently files saved to the Downloads folder in the Files app are saved to:
~/Library/Developer/CoreSimulator/Devices/UUID/data/Containers/Shared/AppGroup/UUID/File Provider Storage/Downloads/

Related

sqlite file gets picked up by the xcode simulator but not the ios device

I had a sqlite file which was working fine on the simulator and the device.
Under my app folder on the mac, I can also see the file - coredata.sqlite.
I created a new coredata.sqlite. After this, I had to copy it over to the paths which were different for different targets (iphone 5 vs 6 vs 6+) and looked along the lines of :
.../Library/Developer/CoreSimulator/Devices/26292D7B-5001-497E-B23B-99455953F5F4/data/Containers/Data/Application/64849BCC-B86B-45DE-818F-3E67346C4893/Documents/
Just copying over the new sqlite to the apps folder where the old sqlite was present did not work. Copying it to the above mentioned folders fixed it for the simulator.
Now, when I connect to my ios device though, it cant find the new sqlite. If I copy back the old sqlite to the apps folder, it still works but copying the new one to the apps folder, the various destinations for the simulator etc has no effect on the ios device.
Displaying the path where it is looking at shows :
/var/mobile/Containers/Data/Application/80302FBA-6D45-4843-A891-E10A7ED4D445/Documents/CoreData.sqlite
Any help on where the device is picking the sqlite from? Since it works on the simulator and the older one works on the device also, the code seems ok. What can I do to get it to pick my new sqlite?
Device will pick the files from mainBundle. While doing database related functionality we copy the db files from mainBundle to DocumentDirectory, so that it becomes editable.
What you did was that you manually copied the sqlite file to the app data document folder. You should actually add the file to specific target and then it will copy the file during build process.
Your new coredata.sqlite file is not attached to any target. Check inside build phases and see if it is there, otherwise add it. Also you should not have two files with same name inside the bundle, so remove the previous file from target.

iCloud documents no longer in Mobile Documents folder?

I have an app that creates a file in the iCloud documents folder. It is working fine, in that the devices that the app is installed on can access and update the file successfully. In my code, a NSLog of the file path gives me:
///private/var/mobile/Library/Mobile%20Documents/iCloud~my-company-name~appname/Documents/document_name
As part of my testing, I need to be able to view this file from my mac. Previously, I was able to do this by looking in my library/Mobile documents folder at the respective app folder.
However, I can't see the app folder in there. Any ideas why this would now not be showing up or pointers to configuration settings I could check? (I'm on Xcode 6.1, mac is Yosemite and all devices are iOS8).
Finder now treats this as a 'special' folder, so actively prevents you browsing the structure. You can do this if you use Terminal instead.

Delete files from File System of IOS SIMULATOR

How to delete images from image folder in library folder of an App created when accessing the app in simulator.The file has to be deleted through coding ie when the app has started running.
folder present in IOS simulator's file system?
The simulator installs apps are here.
/Users/<system username>/Library/Application Support/iPhone Simulator/User/Applications
GUID files and directories install on your simulator.
or you can uninstall app by Long Left button pressing and the cross.
Try this and let me know for any query.
The files that are saved in the library folder are present in the path
/Users/YourSystemName/Library/Application Support/iPhone Simulator/6.0 or 5.0 or etc/Applications
You can delete files of particular application from this folder.
But you can simply reset content and settings of iphone simulator to reset. This can done by
Selecting ios simulator.
Go to top menu and select iphone simulator.
Select option reset contents and settings and then reset.

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":
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.
Window -> Organizer -> select your's Iphone -> Applications -> select your iphone project name and you can see blow in the "Data files in Sandbox"
(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.
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
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 -
Go to plist file of your project.
Set Supports Document Browser to "YES".
You will see the saved file in FILES in your device.
I am using iOS 13 and Xcode 11.6, it worked for me.

iOS app does not have a Build directory with .app in - for binary upload

I have an iOS app which I need to upload the binary of. From what I could find online, I have to ZIP the .app folder and upload that.
Problem is I cannot find my .app directory. In my other apps I do find it. But in this specific one, there is no Build directory whatsoever.
Must I set it in my Target or somewhere for it to create that folder?
(This is in Xcode 4.2)
Does the app appear in the Products folder for your project (should be at the bottom of the project file/folder list in the left column)? If it does, right click on the .app file and choose the Open in Finder option. Zip the Application file and you should be fine.
If this is an app that you can run on a device, choose Build > Archive. The Organizer window will open, and now you can select and "share" the archive.
Otherwise, open the Preferences window and, under Locations, click the arrow next to the Derived Data pathname. Your build folder is usually inside the derived data folder for this project.

Resources