EAS Build and iCloud for DocumentPicker

Hey, I’m using EAS Build to make a development client with a Document Picker on iOS. This means I have to connect my app up to iCloud.

I’ve managed to get it connected to my Team ID but the build fails at the end of fastlane. My error looks like this:

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}

Obviously I need to tell iCloudContainerEnvironment I’m in either development or production, but I’m not clear on how to do that. Using eas-cli/0.33.0. Thanks for help!

Hi @simpleapps

I don’t know off hand, but it seems that the following might point you in the right direction:

So what I would try is the following:

  • Take the default Gymfile from the docs and figure out what you need in the export_options section, including the provisioningProfiles section. Maybe you can generate this to use the correct iCloudContainerEnvironment and provisioning profile depending on an environment variable or EAS build profile.
  • Using eas-build-post-install, generate or copy the above to ios/Gymfile.

@notbrent/@wkozyra, are there any docs that explain how the Gymfile is generated? Is there a better way of customising it in a managed app than the above?

I have now found these too. You might be able to figure out a reasonable way of doing it based on this:

Hey wodin, thank you for the reply. I’ve investigated those source files and come to a conclusion:

First, the best path for me forward would be to go to a bare workflow, as I’m under a deadline and need a solution I can rely on. I love EAS though as it’s made developing this product much faster.

Second, I believe this means it’s impossible to use EAS build managed workflow on an iOS app that requires DocumentPicker. That’s not a deal breaker for most people, and will likely be fixed as EAS nears a 1.0 release.

That’s not a bad option. The Expo team has made it much easier these days than in the past and you could always “uneject” again in future.

If it’s just a matter of arranging for iCloudContainerEnvironment to be set in the exportOptionsPlist then it seems no more complicated than a lot of Config Plugins. I am sure this could be done with a Config Plugin or else with the hook I mentioned in my last message. I suppose the Config Plugin route might be the better option, and maybe the Expo team can make this easier in future.

I didn’t work with icloud stuff before, but it looks like in regular xcode projects this should be specified in .entitlements file, so for a managed project you can define it in ios.entitlements in app.json via com.apple.developer.icloud-container-environment

few links that might be helpful

1 Like