173

I have an image editing app where users can apply effects to photos. How could I enable it so that users can see my app in iTunes in the File Sharing tab and then just drag+drop photos to the app?

Some of the eBook readers like Stanza works like this and it would be a cool option. Maybe someone can point out a tutorial or resource that talks about how to enable and use this technique.

Proud Member
  • 40,078
  • 47
  • 146
  • 231

8 Answers8

301

You just have to set UIFileSharingEnabled (Application Supports iTunes file sharing) key in the info plist of your app. Here's a link for the documentation. Scroll down to the file sharing support part.

In the past, it was also necessary to define CFBundleDisplayName (Bundle Display Name), if it wasn't already there. More details here.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Vin
  • 10,517
  • 10
  • 58
  • 71
  • 62
    For those of you challenged like me that is: **Application supports iTunes file sharing** when editing the *info.plist* file in Xcode. – LavaSlider Mar 26 '12 at 14:50
  • Is there any reason why it couldn't have effect in one application? I enabled it but the the App won't show up on iTunes File Sharing – rraallvv Feb 05 '13 at 07:40
  • @rraallvv are you trying with a development build or an ad-hoc build? – Vin Feb 05 '13 at 07:54
  • @rraallvv you probably have to set up your file types... (document types under target/info) – nielsbot Feb 05 '13 at 08:01
  • And in case anyone else is pulling out hair over it not working, check to see if you perhaps have more than one *Info.plist. – Tony Adams Nov 27 '13 at 18:24
  • Worked like a charm. Thanks Abhi. Note: The names of the mentioned keys may get changed automatically with Xcode intellisence. (Tried on Xcode 7 and used file sharing without the need of a paid apple developer account) – Kushal Ashok Nov 06 '15 at 10:10
  • Some other are details available at https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW20 – Cœur May 12 '19 at 12:26
  • For me, it was ALSO required to set "Supports opening documents in place" to YES, otherwise the app would appear in the Finder, but not in Files. – Seven Systems May 27 '21 at 21:43
50

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. (The actual key name is "Application supports iTunes file sharing")

  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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Nico
  • 1,788
  • 2
  • 23
  • 41
  • 2
    Why should the app not present the user with the list of files? – Cutetare Nov 19 '14 at 14:59
  • 1
    @Cuterare : Suppose, You want only mp3 files in document directory but user puts .pdf files then either you leave it, up to user or handle at your end. So take care of what you are doing with files. It's reference from apple's doc, please visit url. – Nico Nov 20 '14 at 09:36
  • How can I export the log details from windows PC ? – Vineesh TP Feb 09 '17 at 09:04
15

New XCode 7 will only require 'UIFileSharingEnabled' key in Info.plist. 'CFBundleDisplayName' is not required any more.

One more hint: do not only modify the Info.plist of the 'tests' target. The main app and the 'tests' have different Info.plist.

wanyancan
  • 370
  • 3
  • 8
  • Hi. I added "Application Supports iTunes file sharing" - "YES" in my info.plist. But the line is removed automatically when I start "Run" button on Xcode. Don't you have the same problem ? – M.Masa May 11 '17 at 03:34
11

If you find by alphabet in plist, it should be "Application supports iTunes file sharing".

Tim
  • 606
  • 1
  • 8
  • 19
3

In Xcode 8.3.3 add new row in .plist with true value

Application supports iTunes file sharing

oscar castellon
  • 3,048
  • 30
  • 19
3

Maybe it's obvious for you guys but I scratched my head for a while because the folder didn't show up in the files app. I actually needed to store something in the folder. you could achieve this by

  • saving some files into your document directory of the app
  • move something from iCloud Drive to your app (in the move dialog the folder will show up). As soon as there are no files in your folder anymore, it's gonna disappear from the "on my iPad tab".
iVentis
  • 993
  • 6
  • 19
  • Thanks for adding this. The only other thing I found confusing is that the first time you turn file sharing on and save a file you have to eject and reconnect your device for anything to show up. Just in case anyone else wastes time messing around with this. – Cosworth66 Jul 15 '20 at 23:08
1

If you editing info.plist directly, below should help you, don't key in "YES" as string below:

<key>UIFileSharingEnabled</key>
<string>YES</string>

You should use this:

<key>UIFileSharingEnabled</key>
<true/>
Sam YC
  • 10,725
  • 19
  • 102
  • 158
0

In addition to enabling iTunes file sharing, I had to set

"Supports opening documents in place" to "YES"

in order for my app's Document directory to become visible in Files. Reading and writing worked perfectly without that, but I couldn't get at my app's files outside of the app without making that change.

Wayne Henderson
  • 237
  • 3
  • 9