2
votes

I've worked for a while now on my (existing) app to add support iCloud synchronization. In total, I have 3 Versions of the app:

a) regular iPhone version
b) lite (free) iPhone version
c) iPad version

I want to use iCloud to make the core data storage sync between all 3 versions/devices. I've got the implementation, and the development versions I put on my devices worked great.

Yesterday I decided to submit the iPhone versions, but they got rejected:

Invalid Code Signing Entitlements - The signature for your app bundle contains entitlement values that are not supported. For the com.apple.developer.ubiquity-container-identifiers entitlement, the first value in the array must consist of the prefix provided by Apple in the provisioning profile followed by a bundle identifier suffix. The bundle identifier must match the bundle identifier for one of your apps or another app that you are permitted to use as the iCloud container identifier.

Specifically, value "[teamid].com.[myself].[somename]" for key "com.apple.developer.ubiquity-container-identifiers" in [my app] is not supported.

I really have no clue about how those identifiers should look like. On this page: https://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/iCloud/iCloud.html#//apple_ref/doc/uid/TP40007072-CH5-SW1 they say something about containers of my other apps ... do I have to add 3 containers for the 3 versions of my app? So far I configured under project/targets/summary/entitlements:

[x] iCloud Key-Value Store: com.[myself].[somename]
iCloud Containers: com.[myself].[somename]

for all 3 versions (same identifiers). What do I have to configure exactly, so that all 3 versions will sync their core data storage database through iCloud?

3
While giving support for iCloud, Should we enable iCloud in existing working app ID or should we create new app ID with iCloud enabled? - Hawk-Eye

3 Answers

2
votes

According to iCloud Design Guide: iCloud Fundamentals, all your apps sharing your iCloud container, can do so using a single iCloud container (if that is what you wish). The catch here is that the primary (first) container ID must be the Bundle ID of your current app being developed, or a Bundle ID of any of your previously submitted apps (that share the same Team ID).

I'll bring an example,

Let us assume that your app regular iPhone app (a) has a Bundle ID com.yourteam.iphoneapp and it was the one that you submitted first and is available on the App Store. Then you have to provide that same ID as the primary iCloud container ID for all other versions as well.

Here's a relevant section out of the document mentioned above:

In the Xcode target editor’s Summary tab, you can request access to as many ubiquity containers as you need for your app. For example, say you provide a free and paid version of your app. You’d want users, who upgrade, to retain access to their iCloud documents. Or, perhaps you provide two apps that interoperate and need access to each other’s files. In both of these examples, you obtain the needed access by specifying a common ubiquity container and then requesting access to it from each app.

  1. Pick one of your iCloud-enabled apps to serve as the primary app for the common ubiquity container. The app you pick can be the current one you are developing, or another app of yours submitted for distribution in the App Store and whose entitlements use the same team ID.
1
votes

You have probably resolved this issue by now, but the answer is that you just use the same ubiquity container identifier in all apps. You only need one, and it is not dependent on the app name: notice Apple told you to use "[teamid].com.[myself].[somename]" not "[teamid].com.[myself].[appname]". Use "some name" that is consistent between the apps, not the "app name".

0
votes

enter image description hereYou need to create 3 separathe iCloud enabled provisional profiles. Devices that are running the same version of your app can share data on the same iCloud container. But if you wish to have any devices running any one of those three versions of your apps to share data then you need to add those identifiers in the Entitlements section of each version.

There is good tutorial on iCloud from http://www.raywenderlich.com/6015/beginning-icloud-in-ios-5-tutorial-part-1

Edited:

I added an sample picture for your case. Also, the text below is extracted from the tutorial on that website:

Here we use a new method you haven’t seen yet called URLForUbiquityContainerIdentifier. This method allows you to pass in a container identifier (like you set up earlier in the iCloud Containers section) and it will return to you a URL to use to access files in iCloud storage.

You need to call this on startup for each container you want to access to give your app permission to access the URL. If you pass in nil to the method (like we do here), it automatically returns the first iCloud Container set up for the project. Since we only have one container, this makes it nice and easy.