How to set an identity preference in keychain to be used by XCode?
Asked Answered
N

1

6

XCode has an "Automatic Profile Selector" under "Code Signing Identity" in "Build Settings".

Having 2 "iPhone Developer" certificates in the keychain,doesn't appear like there is a way to steer XCode's preference of one over the other.

Codesign lists the following rules for resolving identities.

  1. The identity is first considered as the full name of a keychain identity preference

  2. The identity is located by searching all keychains for a certificate whose subject common name (only) contains the identity

    • If there are multiple matches, the operation fails and no signing is performed
  3. If identity consists of exactly forty hexadecimal digits, it is instead interpreted as the SHA-1 hash

The fact that there are 2 partial matches on "iPhone Developer" suggests that XCode has a different way of resolving identities.

Tried creating an Identity Preference on a certificate which prompts to enter "Location (URL) or Email Address". Not sure what the URL should refer to or the email.

Used "iPhone Developer" as the value instead (keychain happily accepted) but XCode doesn't pick the preferred certificate.

Is there a way to use the "Automatic Profile Selector" yet have it resolve on an "Identity Preference?"

Nougat answered 22/5, 2012 at 9:43 Comment(0)
I
0

I guess by now it's too late, but in Xcode 9, in "Build Settings" -> "Code Signing Identity", with "Code Signing Style"=Manual/Auto, now there are two dropdown lists from which you can select, for both targets, a) one of iOS Developer/Distribution profile type, b) the KeyChains' identity for the developer/distributor.

What worked for me is:

  1. use the same or two different Provisioning Profiles for Debug and Release (created and exported from my developer account website and imported in Xcode)
  2. set "Code Signing Style" to "Manual"
  3. select the imported PPs for the two targets
  4. set the a) and b) lists to the developer/distributor identity whose certificate was included in the PP(s) created in 1)

Now I can run the debug target normally from Xcode with the "Run" button, and at the same time archive and export the release target with the distribution PP.

Isabellaisabelle answered 19/1, 2018 at 11:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.