Xcodebuild Thinks Millennials Are Too Entitled

In repentance for the bad joke, I’ll tell you how to fix a known xcodebuild issue by adding the entitlements back into the archive, and get your OTA build working again.

"My App" Could Not Be Installed At This Time

While I was getting the build server up and running at Wellframe, I encountered a strange issue: our enterprise-signed iOS app was compiling, building, downloading, and then promptly failing to actually install. We have multiple schemes to build staging, production, and internal builds, so I figured there was a mis-configuration somewhere and hunkered down for some debugging. But after checking our xcodebuild script closely and installing the app via Xcode on the same phones, I was at a loss.

After surveying the abundance of xcodebuild entitlement stories on the web, I found that the generated .ipa was simply not being packed with an archived-expanded-entitlements.xcent file. As it turns out, others were having this problem as well (there's even a radar for it). Discovering that this is a known problem took far longer than it should, so I thought I would add my own voice and offer a solution for anyone else with mysterious "could not be installed at this time" errors.

If Xcodebuild Won’t Do It, We’ll Do It Ourselves

Since the error is essentially that xcodebuild isn't adding the file to the .ipa, the simplest solution is to manually put it there. Seems a bit brutish, I know, but it's easy, simple, and gets the job done.

The command I run looks something like this:

$ xcodebuild -exportArchive -exportFormat IPA -archivePath "xcarchiveFolder/app.xcarchive" -exportPath "ipaFolder/app.ipa" -exportProvisioningProfile="profileID" -exportSigningIdentity="iPhone Distribution: MyEnterpriseIdentity"

When this is done, we will have a .xcarchive file in the xcarchiveFolder directory, and a .ipa file in the ipaFolder directory. Then just run the following commands:

$ cd ipaFolder
$ unzip app.ipa
$ cp xcarchiveFolder/app.xcarchive/Products/Applications/YourAppName.app/archived-expanded-entitlements.xcent Payload/YourAppName.app
$ rm -f app.ipa
$ zip -r app.ipa Payload

The .ipa format is really just a fancy zip file. Now that you've added the missing entitlements, you're ready to make your plist and upload the app for OTA distribution.

Leave A Comment

Your email address will not be published. Required fields are marked *