Xcode: Can I set Code Signing Profile from the command line


I have a batch build script that I run to build a common codebase for iOS apps into 100+ unique IPAs. I use Xcode 4.2 on OS X Lion. The build settings for each app are set using PlistBuddy and the build works by running PlistBuddy, installing app icons, running xcodebuild, then xcrun. It has been tested and works correctly when targeting a single app.

Each app has a unique distribution provisioning profile that currently must be manually assigned via Xcode's Project settings -> Code Signing section (for release builds).

My problem is that the build script will not be able to match the App to its profile during the xcodebuild phase. It will simply try to use the most recent app's profile, then generate the error: [BEROR]Code Sign error: Provisioning profile 'MOST RECENT APP'S PROVISIONING PROFILE ID HERE' can't be found.

Desperately looking for a way to either set this via command line (security, plistbuddy, or xcodebuild?). My batch script is quite useless without it.


I found the answer - it was simple. The problem was that in my Xcode target Code Signing settings, I had set a specific distribution profile for the build (out of 90 or so).
What fixed it was simply selecting the profile under "Automatic Profile selection".

Once that was done, xcodebuild was able to run successfully.

This video can help you solving your question :)
By: admin