How to enable file sharing for my app?

IosFile Sharing

Ios Problem Overview


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.

Ios Solutions


Solution 1 - Ios

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.

Solution 2 - Ios

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.

Solution 3 - Ios

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.

Solution 4 - Ios

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

Solution 5 - Ios

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

> Application supports iTunes file sharing

Solution 6 - Ios

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".

Solution 7 - Ios

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/>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionProud MemberView Question on Stackoverflow
Solution 1 - IosVinView Answer on Stackoverflow
Solution 2 - IosNicoView Answer on Stackoverflow
Solution 3 - IoswanyancanView Answer on Stackoverflow
Solution 4 - IosTimView Answer on Stackoverflow
Solution 5 - Iososcar castellonView Answer on Stackoverflow
Solution 6 - IosiVentisView Answer on Stackoverflow
Solution 7 - IosSam YCView Answer on Stackoverflow