iCloud Permissions issue in ad hoc build, but works fine in production build

Hey everyone!

I suspect this is a fairly easy problem having to do with the fact that I’m still not super comfortable with iOS permissions/iCloud containers etc, but could use some help. Heres where I’m at:

Running a release build:

  • Android: :white_check_mark:
  • iOS: :white_check_mark:

Running an Ad Hoc build:

  • Android: :white_check_mark:
  • iOS: :x:

The issue that arises is due to a variable pertaining to iCloud container environment being null. The specific error is:

error: exportArchive: exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided
Error Domain=IDEFoundationErrorDomain Code=1 "exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided" UserInfo={NSLocalizedDescription=exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided}

I’m using the DocumentPicker (DocumentPicker - Expo Documentation) thus had to set up an iCloud container and enable iCloud documents as specified in the link provided. Everything works fine locally, builds for production etc, but does not build when i run an Ad Hoc run. I looked at my Ad Hoc provisioning profile, and it DOES have iCloud as an enabled capability, so I’m not entirely sure where else to go from here haha.

One thing that I WILL note is that I suspect it probably has something to do with the fact that my “Production” panel in the cloudkit dashboard looks like the following:

though if I attempt to “deploy to production” using the cog drop down at the top right of the “Development” panel, it simply says “No changes to deploy. The schema in development is the same as in production”

Could of course also just be that this variable needs to be set somewhere, and it isnt being set now. Just not sure why it WOULD be set in prod and not an ad hoc run.

Let me know if anyone has any ideas/I can provide any more helpful information!

Worked around this, was only using the iCloud stuff for a very small bit of functionality which we’re just replacing with other methods (figured out they were a bit more secure anyways). Still interested in a solution however if anyone has any input/anyone comes across this thread in the future :slight_smile:

hi! I can’t say I definitely have a fix or a solution, but the error message you posted does seem to maybe indicate an issue with your .entitlements file? Since it’s working correctly in production- do you have more than one entitlements file? Sometimes projects have separate ones for development vs production. If not, what’s the value of your com.apple.developer.icloud-container-environment key in your entitlements file?