How to implement iTunes built-in App "File Sharing" feature
Asked Answered
G

3

11

I've noticed that several apps, when an iP* is connected, has a "File Sharing" feature inside of iTunes. Example applications are CloudReaders, Stanza, etc. This interface lets users Add files to the app and Save files from the app to their computers. Right now I've got a HTTP server running inside the app which lets users add files to it via Wi-Fi, but I'd like to support the aforementioned method as well.

Thanks to Art Gillespie, I got this working. Recently, I renamed my project and ended up having to dig around a bit again to figure out how to re-enable this since it went away.

This is how you do it.

  1. In your plist, add a new key for UIFileSharing. It should be listed as something like "Application supports iTunes file sharing".
  2. Build your code in "Release" mode.
  3. Go to the build/Release-iphoneos/ folder of your project and drag the appname file (not the .dSYM one) to iTunes. Click "Yes" if it asks about replacing.
  4. Now if you click on your device and go to "Apps" and scroll down you should see your app listed in the "File Sharing"'s Apps list.
Gyromagnetic answered 13/7, 2010 at 20:14 Comment(2)
You should be more descriptive and clearScripture
Considering I got the answer I wanted within the hour, I'm pretty sure I was clear enough.Gyromagnetic
P
14

You want to add the UIFileSharingEnabled key to your app's Info.plist

Sharing Files With The User

Pena answered 13/7, 2010 at 20:40 Comment(2)
It's not that perfect. "File sharing" is available since iOS 3.2 (which was iPad-only release) so on iPhone/iPod it's available only on iOS4 devices. At the moment those are only about 50% of all iP* devices in use.Peach
Please consider updating your answer with some details from the link included. I've found an alternative location for the link but if that ever is not working then a portion of your answer will no longer be helpful.Migration
A
1

In the new Xcode, you can do this in the UI:

  1. Select your project in top left
  2. Select target in next column
  3. Click on Info tab
  4. In Custom iOS Target Properties, hover mouse over any row and click +
  5. In popup, select "Application supports iTunes file sharing", then set Value to YES on right
  6. Click Validate Settings at bottom to make sure all is good
Areopagite answered 10/6, 2013 at 16:39 Comment(0)
R
0

According to apple doc:

File-Sharing Support
File-sharing support lets apps make user data files available in iTunes 9.1 and later. An app that declares its support for file sharing makes the contents of its /Documents directory available to the user. The user can then move files in and out of this directory as needed from iTunes. This feature does not allow your app to share files with other apps on the same device; that behavior requires the pasteboard or a document interaction controller object.

To enable file sharing for your app, do the following:

  1. Add the UIFileSharingEnabled key to your app’s Info.plist file, and set the value of the key to YES.

  2. Put whatever files you want to share in your app’s Documents directory.

  3. When the device is plugged into the user’s computer, iTunes displays a File Sharing section in the Apps tab of the selected device.

  4. The user can add files to this directory or move files to the desktop.

Apps that support file sharing should be able to recognize when files have been added to the Documents directory and respond appropriately. For example, your app might make the contents of any new files available from its interface. You should never present the user with the list of files in this directory and ask them to decide what to do with those files.

For additional information about the UIFileSharingEnabled key, see Information Property List Key Reference.

Rilke answered 22/11, 2013 at 10:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.