iCloud for Mac doesn't work in GC enabled apps

Originator:alancse
Number:rdar://10212664 Date Originated:30/09/2011
Status:Open Resolved:
Product:iCloud Product Version:10.7 +
Classification:Serious Bug Reproducible:Always
 
Summary:

I've just spent about 2 days trying to figure out why the following code in our Mac app wasn't ever giving me a URL (it always returned nil).

NSFileManager* defaultFileManager = [NSFileManager defaultManager];
NSURL* cloudURL = [defaultFileManager URLForUbiquityContainerIdentifier:nil];
NSLog(@"%@", cloudURL);
I got to the point where I created a new app from the template, and added that code in - (void)applicationDidFinishLaunching:

Now I managed to get this working and returning a valid Ubiquity Container URL in the sample app.

However if I took the same code and the same bundle ID, container identifier, code signing identity etc, and put into my existing mac app, it always returns nil for the cloudURL!

After much digging I realised that the problem was, our app uses garbage collection and the : If I turn on garbage collection in my little sample app (-fobjc-gc-only) I now get a nil ubiquity URL.

I've attached a simple sample application, that you will you need to use your own App ID to replicate the problem.

Steps to Reproduce:

Download the sample app
Set the App bundle ID and signing identity to match your own App ID and provision profile.
Build and run the sample with Garbage Collection disabled.
You should see a valid iCloud URL logged to the console.
Rebuild the sample with Garbage Collection enabled.
You should see nil logged as the iCloud URL.
Expected Results:

At the very least we need this made clear in the iCloud documentation. But a better result would be an error logged to the console. Better yet the URLForUbiquityContainerIdentifier: should take an NSError parameter and let us know that GC enabled apps aren't supported.

Ideally though iCloud should actually work in GC Enabled apps!

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!