objective-ciosbuildcode-signingxcconfig

iOS: Specify code sign identity in .xcconfig file by target


So I have a .xcconfig file set up and wired to a specific target (there are more targets in the project) in the Project settings on the Info tab in the Configurations pane.

The contents of the .xcconfig file look like this:

//:configuration = AppStore //This is the name of the configuration instead of Release
COPY_PHASE_STRIP = NO
CODE_SIGN_IDENTITY = Somecompany Ltd.
CODE_SIGN_IDENTITY[sdk=iphoneos*] = Somecompany Ltd. 
PROVISIONING_PROFILE[sdk=iphoneos*] = 123456789blablablah
//:completeSettings = none

This kind of works. I see that it replaced the Code Sign Identity in the Project settings, but it did not replace all code signing fields in that specific target's settings where I would like.

This is how it looks like in the project settings: Project settings

And this is how it looks like in the target's settings: enter image description here

The question: How can I specify code sign identity in .xcconfig file by target, or what other way is there to make it work?


Solution

  • Turns out the 'code' was right all along. I did not need to add anything to the xcconfig file, it's enough to just wire it to the target on the Info pane.

    The problem was that even if there is a "Don't Code Sign" line set for code signing it still counts as something and the setting does not get overwritten. Selecting the line where it says Don't Code Sign and hitting backspace solved the problem!