iCloud Mobile Documents Not Syncing?

I've been using the ~/Library/Mobile Documents folder in Lion to test adding files to my iCloud-enabled iOS app's Documents folder, and that's been working great for me, up until 10.7.3.

If you've got an iOS device and have iCloud enabled, take a look in ~/Library/Mobile Documents. (You can do this from Finder by picking "Go to Folder…" on the Go menu and typing it in). You should see folders there with names like these:

[cc]
com~apple~Keynote
com~apple~Numbers
com~apple~Pages
RZACDNSPFQ~com~joeisanerd~icatcher
28Y2DX2P93~net~stevex~CloudTester
[/cc]

That last one is my test app. The folder name is the developer's team identifier (so any apps from the same company will start with the same string) and the rest is the bundle identifier of the app.

Before 10.7.3, the Ubiquity daemon (Ubiquity is Apple's developer name for the iCloud services) would run all the time. It's called 'ubd' and you can see it in Activity Monitor. Or you could, before 10.7.3.

With 10.7.3, they decided that the Ubiquity daemon didn't need to be running unless there was some app that used the iCloud services, and so it's not running by default. But it's easy enough to bring back.

There are two ways: One is to run it. You can simply invoke it:

[cc]
/System/Library/PrivateFrameworks/Ubiquity.framework/Versions/A/Support/ubd
[/cc]

But if you "man ubd" you get this warning not to do that:

---

NAME
     ubd -- ubiquity daemon, part of Mobile Documents

SYNOPSIS
     ubd

DESCRIPTION
     ubd is the ubiquity server process. It is primarily used for "Mobile Documents".

     There are no configuration options to ubd, and users should not run ubd manually.

SEE ALSO
     special_file_handler(8)

---

But there is another way. Simply run an app that uses iCloud. These aren't really easy to come by right now but here's a free one that you can get from the Mac App Store: Sticky Notes. Get that app and run it, and take a look in Activity Monitor. The ubd process should show up, and your Mobile Documents will be syncing.

It's obvious from this only-on-when-required behaviour that Apple doesn't intend for the Mobile Documents folder to be a DropBox-style synchronization service. I'm actually surprised that documents other than the ones used by the running app (in this case 2E337YPCZY~it~bloop~memo) are synchronized, and maybe this is a change they'll make in the future. So don't get too used to how this works today.

Side note: You can get all sorts of interesting information on how to use ubd by invoking it with the "--usage" option. I'm not sure they expect us to be poking around here - for example, one of the switches has this note:

apple2: Register in the 'csbonjour.apple.com.' domain.
To see & be seen in this domain, you must be inside
the Apple firewall and must have 'apple.com' in your
DNS search path in the Networking Pref Pane.

So play at your own risk.