Building iOS applications using xcodebuild without codesign
We're building an app for another company. They hold the signing key and would rather not share it with us.
It should be possible to separate build and sign, but how do I specify it on xcodebuild's command line?
In order to skip the code signing you can perform a manual build from the console like this:
xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
Additionally, use the -configuration, -target and -sdk parameters in order to define your build settings.
Refer to this Stack Overflow answer in order to get a detailed description on how to disable code-signing inside Xcode.
To completely prevent code signing with Xcode 7, I used all of the following options:
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"
The final option, CODE_SIGNING_ALLOWED="NO" seemed to do the trick.
Unfortunately it can be hard to build your app in release mode without code signing. You will get errors from the build system such as this:
CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 5.1'
In this case, you should configure your target to use your developer/team wildcard (*) signing identity in Release mode. The app will be signed with that when you build it, and you can ship it to your customer so they can resign it. This is what most of our outsourced developers do.
You may then be able to remove the code signing information by deleting the various files in the app like _CodeSignature and using the codesign tool to remove information from the application binary. But I'm not sure how easy that is. It's not really essential though. There isn't any sensitive information in the provisioning profile or signing information.
In the Project Navigator, select your project and open the "Build Settings" section of your project (and not any particular target).
Under "Code Signing", find "Code Signing Identity" and for both Debug and Release modes set "Any iOS SDK" to "Don't Code Sign".