8

I have a project from which I'm trying to export an Enterprise archive.

This works perfectly via the Xcode interface (Xcode Version 9.3 (9E145)), but I'm trying to do it via the command line (so I can automate this on our CI).

I'm exporting the same archive as from inside Xcode, so I'm reasonably sure the archive itself has been created correctly.

The command I'm running is

xcodebuild "-exportArchive" "-archivePath" "archive.xcarchive" -exportPath . -exportOptionsPlist ./export_options.plist

And the contents of export_options.plist is

<?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>compileBitcode</key>
        <false></false>
        <key>method</key>
        <string>enterprise</string>
        <key>provisioningProfiles</key>
        <dict>
            <key>com.correct.app.identifier</key>
            <string>XC iOS: com.correct.app.identifier</string>
        </dict>
        <key>signingCertificate</key>
        <string>iPhone Distribution: MYBRAND</string>
        <key>teamID</key>
        <string>ABCDEFGHI</string>
    </dict>
</plist>

The error I'm getting is

2018-04-07 16:54:02.104 xcodebuild[67144:5293266] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/c4/t3_jplmx5qn7dkxx95rqv2qh0000gn/T/MyBrand_2018-04-07_16-54-02.095.xcdistributionlogs'.
2018-04-07 16:54:04.108 xcodebuild[67144:5293266] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7fbf2ad5b240>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0 "Locating signing assets failed." UserInfo={NSLocalizedDescription=Locating signing assets failed., IDEDistributionSigningAssetStepUnderlyingErrors=(
    "Error Domain=IDEProfileLocatorErrorDomain Code=1 \"No profiles for 'com.correct.app.identifier' were found\" UserInfo={NSLocalizedDescription=No profiles for 'com.correct.app.identifier' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS In House provisioning profiles matching 'com.correct.app.identifier'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.}"
)}
error: exportArchive: No profiles for 'com.correct.app.identifier' were found

Error Domain=IDEProfileLocatorErrorDomain Code=1 "No profiles for 'com.correct.app.identifier' were found" UserInfo={NSLocalizedDescription=No profiles for 'com.correct.app.identifier' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS In House provisioning profiles matching 'com.correct.app.identifier'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.}

** EXPORT FAILED **

I've sanity checked my export from inside Xcode, and it's using the same certificate and provisioning profile as I have specified in my export_options.plist.

Any suggestions anyone?

deanWombourne
  • 38,189
  • 13
  • 98
  • 110
  • When the xcode build is happening dump all the process using `ps auxe| grep xcodebuild`, just make sure you are not missing a environment variable which is being set by xcode – Tarun Lalwani Apr 10 '18 at 12:47
  • So when you export from the IDE, you are signing with the In House Distribution profile and certificate? Because you chose enterprise as the method, it is looking in your provisioning profiles directory for a provisioning profile that has the Team ID you specified, as well as the app ID, that is a profile type of In House Distribution. Provisioning profile location can be found here: https://stackoverflow.com/a/45642752/3708242 – wottle Apr 10 '18 at 17:09
  • If you want this question to get worthwhile answers, you are going to need to provide more details as requested in the comments. – wottle Apr 12 '18 at 13:51
  • I didn't see any requests for details in the comments (I'd assumed that your point about signing with the in-house certificate was rhetorical or my question wouldn't have made sense) - what more details would you like? – deanWombourne Apr 12 '18 at 15:30
  • I would show your code signing settings in your project. There's a reason you have offered a bounty and there is no activity. Your question above amounts to a very verbose "code signing isn't working for me". There are lots of reasons this could be. You could be missing a private key. You could be signing the binary differently in the IDE vs. command line, even though you think you are trying to sign them the same. Your provisioning profile specified in the export_options.plist might not truly match up like you think it should. – wottle Apr 13 '18 at 19:06
  • Also, I usually use the UUID of the provisioing profile in the `provisioningProfiles` key entry. You can find the UUID by opening the enterprise provisioning profile .mobileprovision file in TextEdit. That makes it very explicit which provisioing profile you want the build to use. – wottle Apr 13 '18 at 19:11
  • Try change the `method development` if it works correctly You have a certificate problem , if Automatically Manage Signing checked try unchecking Automatically Manage Signing, and then selecting your provisioning profile. – a.masri Apr 17 '18 at 08:23

0 Answers0