File Sharing
If your app supports file sharing, its Documents directory becomes available to the user through iTunes (Figure 36-1). The user can add files to your app’s Documents directory, and can save files and folders from your app’s Documents directory to the computer, as well as renaming and deleting files and folders. This could be appropriate, for example, if the purpose of your app is to display some common file type that the user might obtain elsewhere, such as PDFs or JPEGs.

Figure 36-1. The iTunes file sharing interface
To support file sharing, set the Info.plist key “Application supports iTunes file sharing” (UIFileSharingEnabled).
Once your entire Documents directory is exposed to the user this way, you are suddenly not so likely to use the Documents directory to store private files. As I mentioned earlier, I like to use the Application Support directory instead.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access