IOS: specify code signing identifier with .xcconfig file

I am working on an iOS application in a team of several developers. We all have our developer certificates for one development profile. When I create the application we are working on to check it on the device, I need to explicitly specify the code signing identifier for use. Otherwise, if I select the automatic profile selector, I get a code signature mismatch error when loading the application into services such as HockeyApp. Indeed, when I select the automatic profile selector, it seems to select the IOS Team Provisioning provisioning profile, not the development profile defined for the application I am creating.

When I was the only developer of this application, I fixed this problem by hard-coding a suitable code signing object for use in build settings. The problem is that I'm not the only developer in this project. The problem with hardcoding my code signing identifier in my project settings is that I have to delete it every time I make changes to the project parameters, or if I don't have my teammates, they will get errors when they sign the application. stating that the signature code on the computer could not be found.

So, I'm trying to set up a .xcconfig file, where each team member will indicate which code signature identification to use. This file would not be a version, so everyone could set their own code signing signature explicitly without causing problems for other developers on the same team.

I managed to include the .xcconfig file in my project, and it is processed during the build phase. However, I could not write the .xcconfig file, which solves the problem of code signing. I tried putting the following line in my .xcconfig file:

CODE_SIGN_IDENTITY = iPhone Developer: Firstname Name (XXXXXXXXXX) 

where Name Name (XXXXXXXXXX) is the result of copying / pasting the code signing identifier that I want to use from the build settings into the .xcconfig file. Later I realized that all my code signing identifiers for all my development profiles (one for each application or package identifier) โ€‹โ€‹give the same result when I copy / paste them from the build settings into a .xcconfig file.

I was looking for a way to distinguish them, but I could not find the one that works. Do you have any idea how I can solve this problem?

I also tried using the [sdk = iphoneos *] modifier, without success.

I would like to avoid using various assembly configurations because I feel that I will have to combine the changes made in the main configuration into a new assembly configuration, which will be made only with the aim of using the correct code signing identifier. However, I am not familiar with how configuration building works in Xcode, so feel free to teach me this if you think this might be a good solution.

Thanks!

+4
source share
3 answers

Instead of choosing CODE_SIGN_IDENTITY, which ultimately does not matter, you could instead specify PROVISIONING_PROFILE and leave Xcode to sign it with any identity match. This is what we do for our internal build system.

Specify a profile using:

PROVISIONING_PROFILE = cb65516b-ee34-4334-95d6-6fba5f2df574

where the longest hex number is the profile UUID. If you look at the provisioning profile, you will find that most of them are ASCII, although it is a binary file and it has such a section

Uuid
395525c8-8407-4d30-ABBD-b65907223eec

+1
source

We have this job (so others ). Do not include the part between the braces, only the part of the name in front of it. If you need to distinguish, I would recommend calling your personalities in different ways (for example, by including a link to the clientโ€™s name or the name of the project for which you are using the identifier).

0
source

Just add this to xcconfig. *

CODE_SIGN_IDENTITY = iPhone Developer: Name Name (XXXXXXXXXX)

Try this for CODE_SIGN

Then go to "Build Settings" => "Code Signing" => "Submission Profile" => "Left Mouse Button" => Select "Other ..." => enter "$ (inherited)" => Enjoy!

enter image description here

Please tell me if something is not working for you. Hope this helps.

0
source

All Articles