How to export an app bundle from an archive with multiple binaries?

Hi,

I have a macOS app bundle with multiple binaries. I can create an archive, notarize it and export the app bundle all within Xcode. But when I try to export the archive from the command line I get an error message:

╰─$ xcodebuild -exportArchive -archivePath myarchive.xcarchive -exportOptionsPlist myarchiveExportOptions.plist -exportPath ~/Desktop -verbose

2021-12-06 09:03:39.241 xcodebuild[15117:509468] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path "/var/folders/qj/55jnf34d0dz7nrjmw9kkvj6c0000gn/T/....xcdistributionlogs".
error: exportArchive: helperBinary does not support provisioning profiles.

Error Domain=IDEProvisioningErrorDomain Code=10 "helperBinary does not support provisioning profiles." UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription=helperBinary does not support provisioning profiles., NSLocalizedRecoverySuggestion=helperBinary does not support provisioning profiles, but provisioning profile "$myprofile distribution" has been manually specified. Remove this item from the "provisioningProfiles" dictionary in your Export Options property list.}

** EXPORT FAILED **

This is the export options plist I use (that's the one Xcode has exported):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>destination</key>
	<string>export</string>
	<key>method</key>
	<string>developer-id</string>
	<key>provisioningProfiles</key>
	<dict>
		<key>$BUNDLE_ID</key>
		<string>"$myprofile distribution"</string>
	</dict>
	<key>signingCertificate</key>
	<string>Developer ID Application</string>
	<key>signingStyle</key>
	<string>manual</string>
	<key>teamID</key>
	<string>...</string>
</dict>
</plist>

How can I exclude the helper binary for the provisioning profile during the export of the archive? The main executable uses endpoint security. I tried to add a second key for the helper binary to specify no provisioning profile, but that didn't work either.

Note: I already posted this question but wasn't able to edit it anymore. So I had to repost it in order to improve the readability (not ideal).

Accepted Reply

Hi Quinn, thanks for your response. I was finally able to get it to work from the command line. At first I've built an app bundle target and the helper binary target (which would be compiled and then copied into the app bundle) and both targets had the exact same bundle identifier (because they'd be both deployed in the same bundle eventually).

That seemed to be what was causing the problem on the command line, because the export options plist would assign both the helper binary as well as the main app bundle binary the same provisioning profile. Now I've changed the bundle identifier for the helper binary target to something unique and used the same export options plist, which only lists the bundle identifier and the corresponding provisioning profile for the main binary and everything works as expected. (The helper binary does not need a provisioning profile and is a single binary).

In the Xcode GUI I'm able to select the provisioning profile for each target manually, that's probably why it wasn't an issue there.

Replies

This is the export options plist I use (that's the one Xcode has exported)

This is weird. In theory xcodebuild and Xcode should behave the same as long as you give them the same Xcode archive and export options. I’ve no idea why you’d see different behaviour here.

You should open a DTS tech support incident so that I, or one of my colleagues, can dig into this properly.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi Quinn, thanks for your response. I was finally able to get it to work from the command line. At first I've built an app bundle target and the helper binary target (which would be compiled and then copied into the app bundle) and both targets had the exact same bundle identifier (because they'd be both deployed in the same bundle eventually).

That seemed to be what was causing the problem on the command line, because the export options plist would assign both the helper binary as well as the main app bundle binary the same provisioning profile. Now I've changed the bundle identifier for the helper binary target to something unique and used the same export options plist, which only lists the bundle identifier and the corresponding provisioning profile for the main binary and everything works as expected. (The helper binary does not need a provisioning profile and is a single binary).

In the Xcode GUI I'm able to select the provisioning profile for each target manually, that's probably why it wasn't an issue there.

both targets had the exact same bundle identifier

Yikes! Don’t do that!

Now I've changed the bundle identifier for the helper binary target to something unique … and everything works as expected.

Yay!

FYI, I cover the issue of how to choose a bundle ID (and hence a code signing identifier) for a helper tool in Signing a Mac Product For Distribution.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • thanks for the link, that's very helpful! Changing the identifier also solved a problem we had with TCC. When the helper binary wasn't run from inside the bundle (e.g. when debugging in Xcode, it started the binary from outside the bundle (copying into bundle is a copy phase)) it constantly prompted us for allowance, although it was already added. That seems to be fixed now as well with the unique identifier.

  • Extra yay!

Add a Comment