20

We have enabled iCloud capability in our application and enabled below services,

  1. Key-value storage
  2. iCloud Documents

But while trying to export the build through the archive, it's throwing me the below error,

Profile doesn't include the com.apple.developer.icloud-container-environment entitlement.

I have tried to set the com.apple.developer.icloud-container-environment entitlement in Entitlements file also as Production or Development but it did not help me either.

Any clue how to resolve this error?

enter image description hereenter image description hereenter image description here

pkamb
  • 33,281
  • 23
  • 160
  • 191
Bappaditya
  • 9,494
  • 3
  • 20
  • 29

5 Answers5

24

Here's how I fixed it:

  1. I created an iCloud container on the CloudKit dashboard (in the iCloud section of the Signing & Capabilities in Xcode).

  2. I assigned the newly created container to my app (Developer Website > Certificates, Identifiers & Profiles > Identifiers > my app ID > Capabilities > iCloud > Edit button) and saved the app ID configuration.

  3. Then I created a new App Store provisioning profile for this app ID and used it to manually sign the app when I uploaded it in Xcode.

TimSim
  • 3,936
  • 7
  • 46
  • 83
  • Great, thanks !! it worked for me. Now while exporting the archive file its throwing me the below error `Error: exportArchive: exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided` – Bappaditya Nov 12 '19 at 11:51
  • 1
    Sorry, I don't know how to fix that. I don't really understand any of this stuff, I just poke around and try things until something works. There's an answered SO question here https://stackoverflow.com/questions/46423169/xcode-9-server-exportarchive-exportoptionsplist-error-for-key-icloudcontainere so you can maybe try and see if it works for you. – TimSim Nov 12 '19 at 13:17
  • 1
    Thanks, it helped I just had to add `iCloudContainerEnvironment ` key in my export.plist file as the value`Development ` – Bappaditya Nov 12 '19 at 18:15
7

This can also be done by Automatically manage signing. Just select the team, add Capability ICloud. Mark Tick on Container Checkbox and you will get the container there. Reference screenshot attached.

enter image description here

Arsal
  • 343
  • 2
  • 8
  • 21
  • I feel like this needs more info – SeanMC Jul 01 '22 at 22:10
  • I made it the reverse-domain appId I already had. Seems to be the recommendation. but why is it red? the icloud container is red in xcode. App builds and distributes now, I think so I wonder – SeanMC Jul 01 '22 at 22:15
5

I followed this link. Look at the answer from @AppleStaff that says to click this link

Here is a screenshot of it filled out:

enter image description here

In the Description section you can add whatever you. At the bottom of theIdentifier section, it says

We recommend using a reverse-domain name style string (i.e., com.domainname.appname).

Fill it out like this-

Identifier: iCloud.com.yourCompanyName.yourAppName

Description: yourAppNameContainer (or whatever you want)

Press Continue when your finished.

Afterwards, go to Xcode > Blue icon in the upper left hand corner > Signing & Capabilities (in the Targets section) > iCloud (you should have already previously enabled iCloud) > click the small Reload Button (wait a few seconds) > tick the name that you choose above:

enter image description here

Lance Samaria
  • 17,576
  • 18
  • 108
  • 256
3

For me, the trick was making sure it was capitalized: "Production" is different from "production" according to Apple.

As indicated:

https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_icloud-container-environment

1

Try the following steps, which might help you

  • Go to the apple dev portal
  • open Certificates, Identifiers & Profiles section
  • edit/create your existing provisioning profile manually
  • download it from the portal, name it uniquely so you can distinguish it from the Xcode generated, i.e. "MyNewProfile"
  • export the archive and assign MyProfile
Neil Galiaskarov
  • 5,015
  • 2
  • 27
  • 46