(iphone) access device's documents directory from mac?
I'm trying to access the documents directory at iphone device to see a log file that I saved while executing the app.
I know this can be done for simulator. (you can browse the 开发者_开发技巧document directory of your app with Finder)
Can this be done for device?
Thank you
In Xcode 6 you should open Devices window to download it.
You can open Organizer in Xcode and download the documents directory when your device is connected right ?
I'm going to combine the two solutions together and add screenshots for clarity. This is with Xcode 7.
View/Download App Documents
- Open the Devices window through the menu
Window -> Devices
. - Select your device.
- Select your application.
- Click the gear button for the options.
View/Download/Delete Documents through iTunes
IMPORTANT!!!
If you have documents within a subfolder, you will not be able to see or change them through iTunes.
- Select the
Info.plist
file in the Project navigator. - Click the
+
button next to any property to add another. - Scroll down the list or type to find
Application supports iTunes file sharing
. - Change boolean value to
YES
. - Re-build/install application.
Hi Viraj's anwer is the way to go .Here is a screenshot:
iOS provides a framework to share documents between your application & iTunes. Check out the Core Services Layer section of the Apple docs, specifically the File-Sharing Support section. It explains how to do this:
- Add the UIFileSharingEnabled key to your application’s Info.plist file and set the value of the key to YES.
- Put whatever files you want to share in your application’s Documents directory.
On a side note, if this is just for debugging, you can always print logs using the default NSLog function and check the output using OS X's Console.
You also can use itunes for the same, but to view in itunes make change as below in your .plist Add new key as "Application supports iTunes file sharing" and make it as boolen with value YES
With MacOS Catalina, Apple has made it very easy for reading the files written from the Documents directory.
Here are the steps:
- Once the device is connected to the Mac, it should be listed under the 'Locations' section in Finder as follows:
- Select the device. From the tab bar below the device details select 'Files'. You will be able to see a list of apps that stored files to the Documents directory. Expanding each app will show the files with its document directory.
You can drag and drop these files to any location in the Mac for further use
One way can be to use iExplorer Download link iExplorer
精彩评论