Xcode 9 GM - Failed to create target code sign properties mapping, error

Hi there,

I’m trying to build my app on with the Xcode 9 GM stack.

It runs the tests and builds the archive fine. Here is the error I get:

▸ Archive Succeeded
Using export options
Generating export options
using export-method input: ad-hoc
Failed to create target code sign properties mapping, error: failed to run ruby script, output: {"error":"undefined method `[]' for nil:NilClass\n[\"/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__ruby-script-runner__154720919/script.rb:36:in `block (3 levels) in read_code_sign_map'\", \"/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__ruby-script-runner__154720919/script.rb:30:in `each'\", \"/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__ruby-script-runner__154720919/script.rb:30:in `block (2 levels) in read_code_sign_map'\", \"/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__ruby-script-runner__154720919/script.rb:27:in `each'\", \"/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__ruby-script-runner__154720919/script.rb:27:in `block in read_code_sign_map'\", \"/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__ruby-script-runner__154720919/script.rb:25:in `each'\", \"/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__ruby-script-runner__154720919/script.rb:25:in `read_code_sign_map'\", \"/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__ruby-script-runner__154720919/script.rb:57:in `<main>'\"]"}, error: exit status 1
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | xcode-archive (exit code: 1)                                  | 469 sec  |
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/bitrise-io/steps-xcode-archive/issues      |
| Source: https://github.com/bitrise-io/steps-xcode-archive                    |
+---+---------------------------------------------------------------+----------+

Here is the build that failed:

https://www.bitrise.io/build/3ba268e04ca1344d

I’m using the latest version of the Xcode Archive & Export plugin, 2.2.1.

1 Like

Hi guys, same problem here : https://www.bitrise.io/build/dce45a5ec8b94cff

Hi @jeremy.gale & @Ezor, thanks for reporting - we’ll look into this asap!

2 Likes

I have same issue. @daniel Do you have any progress so far?

A new Xcode Archive step was just released. Did you try that? If you’d still get the issue with the new version please share your build url via the bitrise.io onsite chat support.

Here’s what I did so far.

I deleted Xcode 8 and 9 from my Mac. I also deleted provisioning profiles. I installed Xcode9 only and sync(download) provisioning profiles with Xcode9.

I created .p12 and provisioning profiles with bash -l -c "$(curl -sfL https://raw.githubusercontent.com/bitrise-tools/codesigndoc/master/_scripts/install_wrap.sh)" and upload this to WORKFLOW | CODESIGNING. (I deleted previous files).

And deleted expired and team provisioning.

Now I got this error message.

If you can’t find the reason of the error in the log, please check the raw-xcodebuild-output.log
The log file is stored in $BITRISE_DEPLOY_DIR, and its full path
is available in the $BITRISE_XCODE_RAW_RESULT_TEXT_PATH environment variable
Archive failed, error: exit status 65

So I open the log and found this.

Code Signing Error: No profiles for ‘com.surfline.surfapp’ were found: Xcode couldn’t find any iOS App Development provisioning profiles matching ‘com.surfline.surfapp’. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
Code Signing Error: Code signing is required for product type ‘Application’ in SDK ‘iOS 11.0’

** ARCHIVE FAILED **

This is totally wrong because I turned on Automatically manage singing from Xcode.

To find a working setting, I turned off the setting and manually set provisioning and identities. I also set EXPORT_OPTION from app-store to auto-detect in WORKFLOW setting.

This setting worked. But I really need to set Automatically manage signing on. I’m still digging into this issue.

Can you add To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild option when Automatically manage signing option is on?

We’ll check it, but that probably won’t work without providing username & password. We’ll see :wink:

Based on: xcodebuild -h output:

Allow xcodebuild to communicate with the Apple Developer website.
For automatically signed targets, xcodebuild will create and update profiles, app IDs, and certificates.
For manually signed targets, xcodebuild will download missing or updated provisioning profiles.
Requires a developer account to have been added in Xcode’s Accounts preference pane.

Regarding to:

You have several options to keep Automatic code singing setting in your project:

1, Automatic code signing on bitrise

  • use codesingdoc to export your certificate and profiles
    these profiles will be the xcode generated ones, so they need to be updated periodically on bitrise, since automatically managed profiles are expiring

  • use auto-detect export method in xcode-archive step.

This way both the archive and ipa export process will use Xcode managed singing files

2, Force Manual singing on bitrise

  • generate the desired singing files on the developer portal and upload them to bitrise
  • force manual code singing by adding: CODE_SIGN_STYLE="Manual" to Additional options for xcodebuild call input.
  • force the development team, code sign identity and profile (Force code signing with Development Team, "Force code signing with Code Signing Identity and Force code signing with Provisioning Profile step inputs
  • use auto-detect export method in xcode-archive step.

This way you force xcodebuild to use the uploaded code sign files

1 Like

@godreikrisztian

Thanks for response. I have already tried everything before and so far the only way to make build works is set provisioning profile manually.

I used codesigndoc and uploaded files to bitrise. I set Automaically manage signing in Xcode. I also used auto-detect option in export method. But I got this error.

If you can’t find the reason of the error in the log, please check the raw-xcodebuild-output.log
The log file is stored in $BITRISE_DEPLOY_DIR, and its full path
is available in the $BITRISE_XCODE_RAW_RESULT_TEXT_PATH environment variable
Archive failed, error: exit status 65

And below is the raw-codebuild-output.log.

Check dependencies
Code Signing Error: No profiles for ‘com.fishtrack.app’ were found: Xcode couldn’t find any iOS App Development provisioning profiles matching ‘com.fishtrack.app’. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
Code Signing Error: Code signing is required for product type ‘Application’ in SDK ‘iOS 11.0’
** ARCHIVE FAILED **

And this is what bitrise used to build:

$ set -o pipefail && xcodebuild “-workspace” “FishTrack.xcworkspace” “-scheme” “FishTrack” “clean” “archive” “-archivePath” “/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__archive__990969929/FishTrack.xcarchive” | xcpretty

https://www.bitrise.io/build/82f598d1bc397be4

So where are we at with this issue?

I just retried my Bitrise build with Xcode 9 GM using 2.3.0 of the Xcode Archive & Export step. I’m not using any of the “Force code signing with…” options.

It no longer gives the original “Failed to create target code sign properties mapping” error, which seems like progress.

  • When “Select method for export” is set to auto-detect, it builds successfully but only signed with the Developer certificate
  • When “Select method for export” is set to ad-hoc, it fails with:
    ▸ Archive Succeeded
    Exporting ipa from the archive...
    Using export options
    Generating export options
    using export-method input: ad-hoc
    xcode major version > 9, generating exportOptions with provisioningProfiles node
    project does not specify profile for: com.solium.SwPtpMobile, seraching for installed profile for export method: ad-hocs
    Failed to find matching provisioning profiles for: $MY_REDACTED_BUNDLE_ID
  • When “Select method for export” is set to app-store, it fails with a similar error:
    ▸ Archive Succeeded
    Exporting ipa from the archive...
    Using export options
    Generating export options
    using export-method input: ad-hoc
    xcode major version > 9, generating exportOptions with provisioningProfiles node
    project does not specify profile for: com.solium.SwPtpMobile, seraching for installed profile for export method: app-stores
    Failed to find matching provisioning profiles for: $MY_REDACTED_BUNDLE_ID

Note the odd plural on “ad-hocs” and “app-stores”.

Do I need to do something else to get the Ad Hoc and App Store builds to work? (I do have valid provisioning profiles for both of those in my Bitrise app > Code Signing section).

Thanks!

Same problem here https://www.bitrise.io/build/afcd2305adb2349f

Running into the same issue :confused:
Export options: app-store
Force Signing Build Settings: No set
Automatically manage signing is turned on in XCode
Not passing -allowProvisioningUpdates
Build URL: https://www.bitrise.io/build/d2e386c0b3b0c84d
Error: Failed to create target code sign properties mapping, error: failed to run ruby script

It seems that there’s an issue in the Xcode Archive step that is causing these errors. We’re working on the fix and will post back here once the new step version is deployed.

In the meantime the workaround is detailed in this blogpost: https://blog.bitrise.io/new-export-options-plist-in-xcode-9

Only important thing I’d add to the post is: when you do the export from Xcode, don’t select the Automatic option (see screenshot below).

05

1 Like

We’ve released a new version (2.3.1) of Xcode Archive & Export for iOS step.
This version contains a lot of fixes related to the new provisioningProfiles node in the exportOptions.plist. Please update to this version and let us know how it goes!

Thanks for the reports and all your help!

1 Like

I’m still seeing a problem with 2.3.1. My developer certificate expired yesterday, so it’s possible I’m doing something wrong. I re-ran the codesignexport and uploaded the new certs.

I built it with export method of ad-hoc. Here’s what I get:

Exporting ipa from the archive...
Using export options
Generating export options
using export-method input: ad-hoc
xcode major version > 9, generating exportOptions with provisioningProfiles node
generated export options content:

<?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>method</key>
		<string>ad-hoc</string>
		<key>provisioningProfiles</key>
		<dict>
			<key>com.solium.SwPtpMobile</key>
			<string>c6c2c840-9e0d-4262-b3d4-fc5239e7e44e</string>
		</dict>
	</dict>
</plist> <nil>

[09:52:05] set -o pipefail && xcodebuild "-exportArchive" "-archivePath" "/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__archive__237010631/Shareworks.xcarchive" "-exportPath" "/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__export__946475665" "-exportOptionsPlist" "/Users/vagrant/deploy/export_options.plist" | xcpretty

❌  error: exportArchive: No profiles for 'com.solium.SwPtpMobile' were found

If you can't find the reason of the error in the log, please check the raw-xcodebuild-output.log
The log file is stored in $BITRISE_DEPLOY_DIR, and its full path
is available in the $BITRISE_XCODE_RAW_RESULT_TEXT_PATH environment variable
IDEDistribution.critical.log:
2017-09-21 16:52:10 +0000 [MT] Step failed: <IDEDistributionSigningAssetsStep: 0x7f7ff8751010>: 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.solium.SwPtpMobile' were found\" UserInfo={NSLocalizedDescription=No profiles for 'com.solium.SwPtpMobile' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS Ad Hoc provisioning profiles matching 'com.solium.SwPtpMobile'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.}"
)}

I am pretty confused by this. In the certificate-and-profile-installer step it installs the profile that’s references above, c6c2c840-9e0d-4262-b3d4-fc5239e7e44e.

Any idea what I’m doing wrong?

Here is the build if you want to take a look:
https://www.bitrise.io/build/fdedf2860c62b634

3 Likes

I still have the same issue.

https://www.bitrise.io/build/ce68dd938ddeef51

Just to update, I confirmed my provisioning profiles and Identities are working on Xcode 8 stack, it’s just the Xcode 9 stack I’m having a problem with.

Also seeing issues: https://www.bitrise.io/build/4cd305a8e4ad378b