Visioneer DocAir App and iCloud Sync

One of the projects I've been working on lately is iOS software to accompany Visioneer's cordless mobile scanner. The app is in the App Store now, here, but you'll need one of these to use it.

One of the things that makes this app special is that it uses iCloud to sync your scanned documents between devices. This makes for a slick workflow when you're on the road. You can scan a document using the scanner in a hotel room or at a customer's site, and the document will automatically sync, through iCloud, to any other iOS device on the same iCloud account.

In developing this, I came across an incredibly useful feature of iCloud, where Apple will actually host images for you and provide links to the document in iCloud that you can include in email messages.

It's easy, using a high resolution scanner that can output multi-page PDF files, to make very large documents. So you've scanned an 80mb PDF and now you want to send it to someone. What do you do?

The magic here is NSFileManager's URLForPublishingUbiquitousItemAtURL:expirationDate:error:, which lets you query iCloud for an URL that you can use to refer to the item in iCloud.

This function gives you a URL like this one:

https://www.icloud.com/documents/dl/?p=03&t=BAJ_zAdNJv869B6wNp4BKYhjFjWsGPzJS2kB

There's no credentials required to access the data at the URL, but the URL itself is not guessable and the request is https, so this is as secure as your email. The link will expire at some point (you can request a particular expiry time, but I believe the default is about a week) so this isn't permanent hosting, but it's a good way to send a scanned image to someone.

You could do this with DropBox or other services, or by uploading the file to an FTP site, but the nice thing about doing this with iCloud is there's zero setup. Assuming the device is already using iCloud (and most iOS devices are), this just works.