Damien
Damien

Reputation: 2421

Stumped that [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil] keeps returning nil

I have written a simple test application (Mac/Cocoa) to connect to the Key-Value store in iCloud. I seem to be falling at the first fence.

You can see the code for my simple app here and you'll see that I am not getting a URL back from "URLForUbiquityContainerIdentifier" call.

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    // Insert code here to initialize your application
    NSURL *ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];
    if (!ubiq)
        NSLog(@"No iCloud");
    else
        NSLog(@"Yes iCloud");
}

Screenshot of the app running with output:

enter image description here

In term of trying to see if I've everything setup correctly I looked at the setup of my App Id (Test app is called Radio) in the developer provisioning centre:

enter image description here

So that seemed to be ok. Then I re-created my provisioning profile (called Radio Dev 2) and checked that it was using the correct App Id:

enter image description here

Ok, so that also seemed to be ok. I then checked that entitlements was switched on and Key-Value container was activated:

enter image description here

So they are activated. I then took a look at the file itself, just to see if anything jumped out:

enter image description here

So I couldn't see anything jumping out at me in the entitlements file. Lastly, I confirmed that I was signing the build with the correct cert using the provisioning profile that I expected:

enter image description here

I was happy enough with that.

So I'm stumped. I've regenerated everything, etc, to no avail.

I'd really appreciate if anybody has any ideas. Have I missed anything?

Upvotes: 3

Views: 1542

Answers (3)

derjohng
derjohng

Reputation: 877

In my case, I implement the Parts "Add Document Type" and "Add Exported UTI" of Section "Configuring your Project for iCloud". And, it will not keep return nil anymore.

http://www.raywenderlich.com/12816/icloud-and-uidocument-beyond-the-basics-part-3

Upvotes: 0

Usman Nisar
Usman Nisar

Reputation: 3081

I faced same problem. I noticed that in my device setting, I didnt logged in my icloud account. once done with adding my account iCloud. The issue was resolved.

Upvotes: 0

Nicholas
Nicholas

Reputation: 457

Damien's comment on the question had the solution for me. For anyone using Xcode 4.5, you need to click the + below the Ubiquity Containers box. Until I did that, nothing worked.

Xcode

Upvotes: 4

Related Questions