Search code examples
ioscode-signingprovisioning-profilexcodebuild

xcode 7: Building for enterprise and adhoc with the same archive


Currently using the xcode 6 build process, we first create the xcarchive with the following command

xcodebuild -workspace OurApp.xcworkspace -scheme MainScheme \ 
clean archive -archivePath OurApp.xcarchive -sdk "iphoneos" \ 
-configuration "Release" CODE_SIGNING_REQUIRED="NO" \ 
CODE_SIGN_IDENTITY="" PROVISIONING_PROFILE=""

By not doing any code signing and provisioning, we then use the exportArchive command to generate the respective enterprise and adhoc ipas using the same archive like this.

xcodebuild -exportArchive -archivePath OurApp.xcarchive \
-exportPath OurApp-adhoc.ipa -exportFormat "ipa" \
-exportProvisioningProfile "Our Adhoc Provisioning Profile"

and

xcodebuild -exportArchive -archivePath OurApp.xcarchive \
-exportPath OurApp-enterprise.ipa -exportFormat "ipa" \
-exportProvisioningProfile "Our Enterprise Provisioning Profile"

Note that we would have our servers set the appropriate code sign identity before running these exportArchive commands. This worked really well for us since we could use the same xcarchive(takes 8 minutes to compile) and create multiple variants with it(exportArchive step doesn't take more than 30 seconds).

In Xcode7, Apple Introduced exportOptionsPlist. Xcode 7 also saw the introduction of features such as Swift Support and Universal Links, both of which we deploy. These two features require you to use exportOptionsPList it seems. The only way I was able to get exportOptionsPlist is that I could no longer set CODE_SIGN_IDENTITY and PROVISIONING_PROFILE to "" when generating IPA. As a result, our build times will double since we now have to build the xcarchive twice

I was wondering if anyone knows a way to create an enterprise IPA and an adhoc ipa using the same xcarchive.


Solution

  • Hi its not possible because whenever you create an iPA from Archive it create each iPA separately for Adhoc or Enterprise or else.