Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot build XCode project from command line but can from XCode

I've created in XCode a simple navigation-based iPhone app. The app builds and runs properly from under XCode but I cannot get it to build from command line.

From terminal I execute:

xcodebuild -project George.xcodeproj -alltargets -parallelizeTargets -configuration Debug build

but I get that error:

=== BUILD NATIVE TARGET George OF PROJECT George WITH CONFIGURATION Debug ===
Check dependencies
[BEROR]Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain

** BUILD FAILED **


The following build commands failed:
    Check dependencies
(1 failure)

Is there something wrong with the way I try to handle it?

like image 591
mgamer Avatar asked Oct 03 '11 12:10

mgamer


2 Answers

In addition to unlocking the keychain, you might also specify the codesign identity (or set it in your target). Development certs take the form 'iPhone Developer: Company Inc', distribution certs like this 'iPhone Distribution: Company Inc'.

xcodebuild -project George.xcodeproj -alltargets -parallelizeTargets -configuration Debug build CODE_SIGN_IDENTITY='iPhone Developer: Company Inc' 
like image 98
Bryan Avatar answered Oct 16 '22 15:10

Bryan


You can build from the command-line a build targeted at the simulator without signing issues.

This solved the signing issue for me:

xcodebuild -sdk iphonesimulator

Source: xcodebuild Code Sign error: No matching codesigning identity found:

That's particularly useful if the command line build is there only to sanity check the source code in a continuous integration setup.

like image 6
Stéphane Gourichon Avatar answered Oct 16 '22 15:10

Stéphane Gourichon