CODE_SIGN_IDENTITY parameter for xcodebuild (Xcode 4)

I use the xcodebuild utility that comes with Xcode 3 to automate my builds under Hudson. The command is as follows:

 xcodebuild -project Project.xcodeproj -target Target -configuration Release -sdk iphoneos CODE_SIGN_IDENTITY[sdk=iphoneos*]="iPhone Distribution:XXXXXX" 

I am trying to use the same command for Xcode 4, but it seems that xcodebuild simply ignores the CODE_SIGN_IDENTITY parameter and signs the provisioning profile that is selected for the target in Xcode.

This is very important for me, since I have to sign the assembly with 3-4 different profiles. It works fine with Xcode 3, but does not work with Xcode 4.

Any ideas how to solve this problem?

+9
source share
5 answers

The new xcodebuild now allows you to set parameters. Taken from developer.apple.com :

 xcodebuild [-project projectname] [-target targetname ...] [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [buildaction ...] [setting=value ...] [-userdefault=value ...] 

I also found this resource to explain the available

 CODE_SIGN_IDENTITY (Code Signing Identity) Description: Identifier. Specifies the name of a code signing identity. Example value: iPhone Developer 

However, the index of available commands is missing PROVISIONING_PROFILE.

In the last command, I used the specified settings "CODE_SIGN_IDENTITY" and "PROVISIONING_PROFILE".

 xcodebuild -sdk <iphoneos> -target <target_name> -configuration <Debug> CODE_SIGN_IDENTITY="iPhone Developer: Mister Smith" PROVISIONING_PROFILE="XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX" 
+7
source

I had the following problem:

Our developers used the iPhone Development Signature ID, but I needed to use the iPhone Distribution Signature ID for our automated integration system.

So I added the line:

 codesign -f --sign "iPhone Distribution: XXXXXXX" ${PATH_TO_APP} 

between the xcodebuild and xcrun to replace code signing identifiers (see the -f flag).

+3
source

As far as I know, in Xcode 4, signing is done using the xcrun tool:

 /usr/bin/xcrun -sdk "iphoneos" PackageApplication -v "myapp.app" -o "myapp.ipa" --sign "iPhone Developer: XXXXX" --embed "XXXXX.mobileprovisioning" 

This is a bit inconvenient to use, because you must specify both your identity and the mobileprovisioning file. It’s especially inconvenient if you use the last one from the ~/Library/MobileDevice/Provisioning Profiles/ directory because its name changes every time initialization profiles are updated automatically with the Provisioning Portal.

+1
source

Just use CODE_SIGN_IDENTITY = "Distribute iPhone: XXXXXX" with Xcode 4 (without [sdk = iphoneos *])

 xcodebuild -project Project.xcodeproj -target Target -configuration Release -sdk iphoneos CODE_SIGN_IDENTITY="iPhone Distribution:XXXXXX" 
+1
source

I found a great workaround for building with jenkins.

First, before setting up the job, download the jenkins plugin with the name:

Parameterized Trigger Plugin

https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin

Once you do this, create your task and when creating the task, select

'This assembly is parameterized.'

Create a string parameter. I call my CODE_SIGN_IDENTITY.

So, the name field in the String parameter should be:


Name: CODE_SIGN_IDENTITY

Default value: iPhone Developer: XXX XXXXX

Description: whatever you post there


Then, in your Xcode Plugin, find the "xcodebuild Custom Arguments" field.

In the xcodebuild Custom Arguments field, put the following value:

CODE_SIGN_IDENTITY = $ {CODE_SIGN_IDENTITY}

Complete the setup of your work, and you must be tuned!

This will do without spaces. The plugin is a life saver, because it works great, and you can customize your assembly with other parameters.

0
source

Source: https://habr.com/ru/post/908354/


All Articles