Reputation: 2686
there's a way to access a real device (iphone/ipad) document folder? I realized an app that store some data in that folder and i wanted to check if all is going in the right way.
Upvotes: 76
Views: 108752
Reputation: 956
Open Xcode: Launch Xcode, the integrated development environment for macOS.
Open Your Project: Open the project for which you want to enable file sharing.
Navigate to info.plist: In the project navigator on the left side of the Xcode window, find and select the info.plist
file. This file contains configuration settings for your app.
Add Key-Value Pair: Right-click on an empty area in the info.plist
file and select "Add Row". In the newly added row, enter UIFileSharingEnabled
for the key.
Set Value to YES: After adding the key, set its value to YES
. You can do this by clicking on the value column next to the key and typing YES
.
Save Changes: Save the changes made to the info.plist
file.
Build and Run: Build and run your app on a physical iOS device. Ensure that the device is connected to your computer.
Open iTunes: Launch iTunes on your computer.
Select Your Device: Connect your iOS device to your computer via USB. In iTunes, select your device. You might need to unlock your device and trust the computer if prompted.
Navigate to File Sharing: In iTunes, navigate to the "File Sharing" section for your connected device. You can usually find this under the "Apps" tab for your device.
Select Your App: Under the "File Sharing" section, you should see a list of apps that support file sharing. Find and select your app from the list.
Access Files: Once you select your app, you should see any files that your app has created and is capable of sharing. You can now manage these files directly through iTunes.
That's it! You've successfully enabled file sharing for your iOS app and can now access its files through iTunes on your computer.
Upvotes: 1
Reputation: 3526
Just add this key in our plist and you're good to go
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
Visit this link for detailed explanation
Upvotes: 3
Reputation: 19642
You can do this without iTunes and even if the file is somewhere else in the sandbox other than Documents.
Go to Window/Devices in Xcode.
Next, select your device, and find the app in the list.
Now, look at the little gear icon at the bottom of the devices window. Click that bad boy.
See "Download Container..." in the list. Guess what that does? You got it. It downloads the whole sandbox with all the folders in the app's sandbox. Right click and "Show Package Contents".
This should let you see the sandbox of apps that have not yet been released. So, good for testing on a real device.
If you're testing on a simulator life is way easier. Just download the free app OpenSim here . Update: These days I prefer SimSim, also free here.
Upvotes: 148
Reputation: 26
If you are looking for a tool that import file from iOS app document folder to Mac, install Apple configurator 2 (https://apps.apple.com/us/app/apple-configurator-2/id1037126344?mt=12)
Connect your device to Mac and in Apple configurator follow below steps
Double click on the Device
Choose Actions > Export > Documents.
Select the file inside app to export, then click Choose. Save the items to the desired location in Mac.
Upvotes: 1
Reputation: 470
You can access documents directory from code using:
+ (NSString *) applicationDocumentsDirectory {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
return basePath;
}
And you can then go to terminal for the same path and check all the files.
e.g on my system its like this:
~/Library/Developer/CoreSimulator/Devices/<deviceID>
Upvotes: 2
Reputation: 3118
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". (the key name is UIFileSharingEnabled
)
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.
Upvotes: 86
Reputation: 1979
iExplorer can help in figuring out for an iOS app. :)
Edit:
You are right, give a try to iMazing
Upvotes: 5
Reputation: 3317
Your question is a bit unclear, but I can see three interpretations:
You can plug your iPhone into iTunes to see your documents folder for any app with iTunesFileSharing enabled, including any apps you have written or are writing.
If this is your own app, and you need help reading files from the documents folder, take a look at this question.
If this is someone else's app, and you want to access the app's documents folder without iTunes and the app does not have implementation for what you want, then I am afraid some sort of jailbreaking and hacking is necessary.
Upvotes: 6