0

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?

Zoltán Matók
  • 3,923
  • 2
  • 33
  • 64

3 Answers3

4

Just add this to xcconfig.*

PROVISIONING_PROFILE = fea8c55b-1fb4-4f64-9001-a12e998e3fdd

Then go to "Build settings" => "Code signing" => "Provisioning profile" => "Left mouse button click" => Select "Other..." => enter "$(inherited)" => Enjoy!

enter image description here

Please tell me if something doesn't work for you. Hope it helps.

Nuzhdin Vladimir
  • 1,714
  • 18
  • 36
1

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!

Zoltán Matók
  • 3,923
  • 2
  • 33
  • 64
  • That's true! When the settings item is bolded, it means it has a somehow "constant" value that couldn't be replaced by xcconfig value. – marcinax Jul 27 '20 at 13:33
  • 1
    @marcinax to be precise, a field being bolded means that it has some value directly assigned to it in the _target_ settings, that is different from the default value in the _project_ settings (and which is therefore not inherited). – Zoltán Matók Jul 27 '20 at 13:54
1

You can use a variable defined in your xcconfig and use it under the target build settings in the way of $(YOUR_VARIABLE).

In order to set it in the project, you must select "Other" from the bottom of the list and them input the statement $(YOUR_VARIABLE).

Fred
  • 3,324
  • 1
  • 19
  • 29