1

For example, is it possible the storage container key in the entitlements dictionary would accept "*" or "/", allowing me to access any and all data in that user's iCloud?

I am not worried about getting this app accepted into the app store.

Rahul Gupta-Iwasaki
  • 1,683
  • 2
  • 21
  • 39

1 Answers1

0

No.

And, even if you could, there wouldn't be any way to enumerate that data. -[NSFileManager URLForUbiquityContainerIdentifier:] and friends require you to know the containers you want to access. (You can pass nil, but that just returns the first container you have access to, not some parent of all containers.)

And this is intentional. The public APIs aren't meant to let your app interfere with other apps' storage (except for related apps that share a team), for pretty good reasons. You may want to read iCloud Storage in Mac App Programming Guide (which doesn't require a paid membership to access).

So, how does the iCloud preference pane do it? Well, that's a secret. Presumably it either uses private APIs, or just talks to the iCloud web service directly in a way that the APIs can't. You could presumably reverse-engineer it, but that's the only way you'll be able to do this.

abarnert
  • 354,177
  • 51
  • 601
  • 671
  • just curious, isn't it possible to discover which containers I want access to by looking in the "~/library/Mobile Documents" folder on my mac and following the naming scheme there? – Rahul Gupta-Iwasaki Jul 12 '12 at 21:04
  • So, how do you get from bundle ID 'com.melodis.soundhound-free' to container ID '356QY8883U~com~melodis~soundhound~free'? – abarnert Jul 12 '12 at 21:16
  • Not to mention that this will only show you all containers that are sync'd from your iOS device to your Mac, which is not the same as all containers sync'd from iOS to iCloud or all containers synced from Mac to iCloud (and in fact probably has very little overlap). – abarnert Jul 12 '12 at 21:17
  • hmm, it seems to me like every iCloud enabled app I have so far on my mac (albeit which isn't very many) creates a container in Mobile Docs, regardless of whether it stores data there or not. As well, while I don't see the bundle seed id for Apple's own apps (mail, notes, preview, etc.), I do see the bundle ID for Bloop's memo, as their container within Mobile Docs is "2E337YPCZY~it~bloop~memo", unless that just happens to be a part of their bundle ID which looks very much like the seed id – Rahul Gupta-Iwasaki Jul 12 '12 at 21:23
  • At this point, it sounds like you're interested in reverse-engineering the way iCloud works in Lion (or in iOS? you've got both iphone and osx tags), not in using the iCloud API. Which is certainly an interesting project, so I don't want to discourage you from learning (and sharing) all you can. Unless that's illegal in your jurisdiction and IANAL doesn't protect me, in which case I _do_ want to discourage you. :) – abarnert Jul 12 '12 at 23:24