bdepaz
bdepaz

Reputation: 454

iCloud and Core Data not working - URLForUbiquityContainerIndentifier is nil

I am not that familiar with iCloud integration. I read numerous bad reports about the integration in iOS 5 and 6. But now I guess it's better in iOS 7 so I decided to add it in one of the new apps I'm working on.

From what I read and saw in the WWDC 2013 CoreData/iCloud video I thought it was as simple as flipping on iCloud in Xcode and configuring the NSPersistentStoreUbiquitousContentNameKey value to something unique in the addPersistentStore call, to get started. But each time I run the app, in the simulator or on a physical iPhone, the console output shows the iCloud setup failed due to URLForUbiquityContainerIdentifier returning nil.

I am using Xcode 6 beta and the iOS 8 beta 2 SDK. I've made sure iCloud is signed in and otherwise functioning on the simulator and physical devices. I've also made sure that the "Documents/Data" switch is on under iCloud setting and the app IS appearing here. I've also browsed to the simulator application directory and I see the SQLite file in the normal documents directory and in an iCloud directory.

Is there something really simple I'm missing?

Upvotes: 2

Views: 858

Answers (3)

Hari
Hari

Reputation: 11

There is bug in Xcode 6 beta version , i am using Xcode6 beta 5 and facing same problem.

I changed key com.apple.developer.icloud-container-identifiers to com.apple.developer.ubiquity-container-identifiers" (ubiquity, not icloud). Then add an item to this as "iCloud.$(CFBundleIdentifier)". In "Capabilities" tab Xcode will show error in red mark but don't fix it , leave as it is.

If solved my problem and i am getting Url now.

Upvotes: 1

CMont
CMont

Reputation: 700

Not sure what the developer agreements allows to say, but at the time of writing this, it is still beta and most probably is a bug in xcode 6. There may be a few threads on the developer forum on that exact same subject. Search for 'URLForUbiquityContainerIdentifier' and you may find more information.

Try beta 4. My iCloud code is now working.

Upvotes: 0

Tom Harrington
Tom Harrington

Reputation: 70936

You didn't mention configuring your app ID for iCloud access and updating your provisioning profile, so that's probably the problem. The device needs to know that your app is allowed to talk to iCloud, and it does that based on the provisioning profile. You'll need to go to the iOS developer site and:

  1. Update the app ID to add the iCloud capability
  2. Regenerate the provisioning profile so that it includes the new capability
  3. Download a new copy of the profile and make sure that you're using it in testing (it's best to delete the old copy first just to be sure).

Upvotes: 0

Related Questions