Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a non-default keychain in Xcode

How can I use a non-default keychain in Xcode iPhone project.

I have already tried '--keychain mycerts.keychain' in 'Other Code Signing Flags' in 'Code signing' build settings.

like image 811
notnoop Avatar asked Aug 31 '09 03:08

notnoop


4 Answers

After a long time of research, I concluded that it cannot be done.

like image 155
notnoop Avatar answered Oct 06 '22 23:10

notnoop


The codesign tool requires an absolute path to the keychain.

Use an additional "Run Script Build Phase" to call the codesign tool with the custom keychain. The embedded script should look like:

codesign -s 'your-identity' --keychain "${SRCROOT}/path/to/keychain" "${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

enter image description here

like image 29
Graham Miln Avatar answered Oct 07 '22 00:10

Graham Miln


in the Build setting under Code Signing -> Other code signing Flags, create a flag "--keychain keychain-name.keychain"

like image 45
Ash Avatar answered Oct 07 '22 00:10

Ash


While inconvenient, you can temporarily change your "default Keychain" to whichever keychain has your certificate/keys. XCode will then search that keychain during code-signing. You can do this via Keychain Access.app or the security(1) command-line utility. You're responsible for unlocking said keychain yourself, however.

like image 25
gorbster Avatar answered Oct 06 '22 23:10

gorbster