iCloud Drive and Document Picker for iOS 8: Explained

iCloud Drive and its associated Document Picker are new features of iOS 8 that allow the app you're using to open files created in a different app, import them, move them, or export them right back out again, all without creating any unnecessary steps or complicated workflows. Everything is also automatically synced through iCloud, so changes made in one app won't only be reflected back in the original app that created the file, but on all your devices. It's yet another way inter-app communication has come to the iPhone and iPad. So, how do iCloud Drive and Document Picker work?

From work to workflow

One of the design goals of the original iPhone and iPhone OS was to liberate mainstream customers from the legacy and tyranny of the file system — to prevent documents being strewn over a desktop or buried in a hierarchy. Sure, some people loved file systems and others learned to cope with them, but to many more they are simply confusing, inaccessible, and ultimately inhuman.

For the Photos app, Apple provided a fairly flat repository which included the Camera Roll and an ImagePicker so that other apps could pull images out and, eventually, save them back. It was a duplicative procedure, however, and it only worked with photos and videos in that repository.

For other files, you could access and edit them freely from within the app that created them, but they were "private" — invisible to any other app. The best you could do, if you wanted to move a file around, was to go to the original app and, if implemented, use the "Open In..." functionality to export a copy to another app. At that point, however, they were treated as separate files and changes made in one app weren't reflected in the other.

It was maddening and I begged for years for Apple to give us a Document Picker equivalent to ImagePicker instead.

Well, with iOS 8, they have.

How iCloud Drive works

There are many different types of files. Text files, documents, spreadsheets, presentations, and images are all common types. The saved state of a chess game, however, is also a file. Anything a person would consider its own discreet entity, and could possibly want to share or do something with can be considered a file.

In iOS, all files created by an app are kept safe and secure inside that app's container. In iOS 8, to make files accessible outside their app's container — without scrapping the security — Apple is allowing developers to make those containers "public" — to make them visible.

So, with iOS 8, when you tap to open a file, and choose iCloud Drive as your source, instead of just the files associated with the app you're in, you'll see folders representing all the other apps installed on your iPhone or iPad that have their containers set to public. Tap on one of the folders and you see the files contained in that app. Tap on one of those files and you punch a hole in the sandbox just big enough to get access to the file.

Once you've access an external file, that file will remain accessible to the current app and to you, right alongside the internal files. iOS keeps its preview thumbnail and name — along with an optional annotation to show which app it comes from — readily available. In other words, your inter-app permission is persistent.

So, of example, if you're in Pages and tap to open a file, then tap iCloud Drive, and you see the "Text Editing App" folder, you can tap on that, and then tap on your Bucket List file. Pages will then open a version of the file and let you work on it. Changes you make will be saved back to the version in "Text Editing App". And Bucket List - "Text Editing App" will, from then on, be listed alongside all your local Pages documents.

Same with an image you started in Brushes but want to continue in Prototype, if both apps choose to support it. Same with a chess game you want to email to a friend so they can continue it for you in their version of the same chess app.

Instead of opening files, iCloud Drive can also be used to import them instead. For example, if you wanted to bring slides from one Keynote deck into another, the file with the additional slides could be imported instead of opened. Likewise if you wanted to import an image into a Pages document.

In addition to import, documents can be exported to other apps if you don't want to keep a copy in the current app.

iCloud Drive launches with a grid view that shows you all files stored directly in iCloud Drive, as well as all the apps that have files stored in their own containers in iCloud Drive. Apps are distinguished by their icons placed on top of folders.

That way, as long as you remember which app created the file, you'll have an easy way to find it. If you can't, there's a handy search box. You can also change the view from grid to list, and in list view you can quickly sort by date, name, and even tags.

Yeah. Tags.

Developing for iCloud Drive and Document Picker.

With iOS 8, the iCloud daemon has been rewritten on top of CloudKit, Apple's new server-side API. To avoid data loss due to read/write conflicts spanning multiple apps and devices, Apple stresses the importance of using file coordination. (The iCloud daemon makes it impossible to assume there's only ever one process accessing a file at any one time.) This avoids file corruption and data loss for customers, which is paramount.

Apple has provided frameworks to make file coordination easy, including background cues, with high, middle, and low-level options. Unlike the previous, synchronous file coordination APIs, Apple has also provided new, asynchronous APIs. The metadata query API is also easier and faster to use, with "stitching" available, so you don't have to wait long periods of time for the information to move over. Metadata can also be accessed and displayed, even for non-local documents. (And listing documents doesn't require file coordination.)

Document previews are encouraged because they make files more recognizable. iOS 8 makes it much, much easier to generate them as well. Apple lets developers pull an array of 1024x1024 thumbnails for a documents, and when changes are saved, updated thumbnails will be generated and synced across devices.

Apple provides the Document Picker interface to handle all the interactions and to keep everything secure. Document Picker is what discovers files outside the current app's container, and what people use to grant permission to access and edit those documents.

In order for Document Picker to discover files, the app that created those files has to signal that its container is public. If an app's container is public, its icon will show up either inside a folder in the grid view or by itself in the list view. Developers can specify the types of files their app works with, so only those file types are shown in the Document Picker. That keeps it focused and makes any given file easier to find.

Once a file from another app container is opened in a new app, Apple provides a document reference as well as metadata. That way developers can list both the local files internal to their app, and the external files made available from other apps, all in the same interface, making it easier to re-open those external files again and again. (However, Apple recommends annotating those files with the name of their originating app, just to keep things clear.

When files are imported rather than opened, iOS makes them available only temporarily. If developers want to hold on to the contents longer, they need to copy them inside the app.

Apple also provides mechanisms for state restoration, including bookmarking. That way, you can leave a document in one app, open it in another, and pick up right where you left off.

iCloud Drive and Document Picker security

In iOS, by default, no app can access the container of another app. Getting around that requires an explicit human override, namely opening Document Picker and tapping an external document to indicate you want to access it outside its container. Document Picker runs "out-of-process" for that reason — so it can see all apps in all public containers.

When you tap on an external file, Document Picker returns a "security scoped" URL. That informs the kernel and the current app that it's allowed to open and modify the file.

These security scoped URLs can't be saved and accessed arbitrarily. They'll lose their security if they are. So, Apple provides ways for them to be safely, securely recorded so they can be used for populating lists, restoring state, bookmarking, etc.

Bottom line

iCloud Drive and Document Picker are quantum leaps forward when it comes to file handling on iPhone and iPad. I could quibble about thee being no iCloud Drive app, so i can't simply browse all my files, or that there doesn't yet seem to be a way to access Document Picker from within the Mail app, like there is the ImagePicker. As a first step, however, both iCloud Drive and Document Picker are grand.

Since Extensibility lets third party storage providers like Dropbox and corporate document stores hook in as well, they maintain much of the simplicity of iOS while returning much of the power of computing.

In other words, iCloud Drive and Document Picker show we really can have nice things.

More of iOS 8: Explained

Rene Ritchie
Contributor

Rene Ritchie is one of the most respected Apple analysts in the business, reaching a combined audience of over 40 million readers a month. His YouTube channel, Vector, has over 90 thousand subscribers and 14 million views and his podcasts, including Debug, have been downloaded over 20 million times. He also regularly co-hosts MacBreak Weekly for the TWiT network and co-hosted CES Live! and Talk Mobile. Based in Montreal, Rene is a former director of product marketing, web developer, and graphic designer. He's authored several books and appeared on numerous television and radio segments to discuss Apple and the technology industry. When not working, he likes to cook, grapple, and spend time with his friends and family.

12 Comments
  • My understanding of iCloud Drive is that it acts like Dropbox in that I can add any file to the drive in any folder structure I want. Is this correct? Can I then open any file I added to iCloud Drive in an iOs app?
  • I thought that too! I figured it was something like OneDrive, Google Drive or Dropbox. So it isn't? Well I'm disappointed...
  • ICloud drive will allow this as well, at least from a desktop/laptop. You should then have access to those files on your iphone/ipad as well.
  • You mention that as of yet Apple's Mail app cannot access the DocumentPicker.
    Would a 3rd party email app be able to access it?
  • Yes, as long as they build in support once ios8 is available.
  • Great article. The only real problem I have with this new facility is that it seems that logically, they have the actions "backwards" when it comes to dealing with foreign files. When trying to access a file in another apps repository, I think the average user would expect "open" to open a copy of the file so you could work on it, but not necessarily copy the file to the second repository. There is also the confusion of multiple copies. Either the file is a copy, and the original copy exists in the old app (giving you two copies of the same file that have different contents and revisions), or there is still only one copy of the file, but it can be viewed in two separate "places" (repositories). This is way confusing. Conversely, I think the average user would expect "import" to actually make a copy of the file in the new repository, perhaps even renaming it and leave the original where it was, whereas according to the description here, the file is actually moved to the new location in the new repository. This is the exact opposite of what "import" does on any other computer. Here is also where Apple penchant for remaking the file system *backwards* (leaving out the need to explicitly save files), gets in the way as well. All the files in both situations are saved automatically, seemingly in different locations, seemingly multiple times, and possibly in multiple versions, even though they are all named the same, because the user has never been asked to explicitly save a file. I could be just reading this explanation incorrectly, or the explanation could be incorrect itself, but I find this all seriously confusing. I think the average user will have oodles of problems with this and understanding which files are being used, changed, moved or renamed. The very fact that there has to be such a long article explaining what's going on is a huge red flag in the first place.
  • Sounds as if only DocumentPicker is crucial for this functionality and iCloud Drive exchangeable. I hope Apple allows third party cloud services to integrate deep enough into the system to be used instead of iCloud Drive. I won't move away from Dropbox.
  • Not sure this apparatus is really simpler than a little folder/file system for those of us who like that. To be fair, Rene did throw us a mention in part of the opener, thanks :)
  • I'll stick with OneDrive as it works well with my iOS devices, Mac, and PC plus I have 28GB free storage on it.
  • For the end user, how is icloud drive different to iDisk from mobile me, I liked iDisk and when it ended I use sugarsync as not keen on icloud for documents, thx bruce Sent from the iMore App
  • A few typos, FYI/correction (speaking of quibbling): "Anything a person would consider its own discreet entity," ⬅️ Should be "discrete". [...] "Once you've access the" ⬅️ Should be "accessed". [...] "So, of example, if you're in Pages" ⬅️ Should be "for example". [...] "(However, Apple recommends annotating those files with the name of their originating app, just to keep things clear." ⬅️ Needs a ). [...] "I could quibble about thee being no iCloud Drive app" ⬅️ Should be "there".
  • Hi Rene I'm still confused about iCloud drive. Basic question Could I have a folder, say "Apple financials 2014” that contains PDFs, keynotes, pages, and numbers documents on this topic? Can I open them on Windows via Numbers in iCloud , on my Mac, and my iOS devices? How do the documents get there? Can I create a new document in numbers for iOS and save it there? Extended question
    With the confusion about what to do until Yosemite comes out, should Apple have left iCloud drive as an 8.1 update? There are people who upgraded early and are in a state of confusion with no quick answer. If iCloud drive couldn't be a point update to Mavericks, then perhaps waiting for iOS 8.1 should have been the direction.