Question: I'm trying to build and archive (in Release and Debug mode) an ios project generated with apache cordova 4.0.0, via command line tool xcodebuild

These commands work ok:

cordova platform add ios

cordova prepare ios

cordova build ios

The ios project generated by cordova has a scheme called iHogar. After that, when I try to launch this command on the console:

> 
> xcodebuild -scheme iHogar -sdk iphoneos -configuration Debug
>  CODE\_SIGN\_IDENTITY="iPhone Distribution: S-N-A L-C-A, S- CO-P-Ñ-A DE
>  SE-U-O- Y R--A-E-U-OS (xxxxxxx)"
> 
> 
> 

It stops at the beginning of the execution, and does not continue. The value of param CODE\_SIGN\_IDENTITY is modified due to privacy reasons.

Here is the output of the command, through console:

> 
> Build settings from command line:
>  CODE\_SIGN\_IDENTITY = iPhone Distribution: S-N-A L-C-A, S- CO-P-Ñ-A DE SE-U-O- Y R--A-E-U-OS (xxxxxxx)
>  SDKROOT = iphoneos8.1
> 
> 
> 

And stops there without finishing the command (it hangs) , only stops with crtl+C

The certificate is ok, and also the provisioning profile. If I open the project with Xcode (version 6.1) everything goes ok, I can build and archive it without problems, with the same certificate and provisioning profile.

Has anyone experienced this behavior?

Thanks in advance

Answer: 
I have resolved this issue. The problem was that the cordova generated ios project hasn't got schemas. Those are created the first time you open the project with XCode. When the app has been created by cordova, is only created with targets.

In this scenario, that the generated app cannot be opened with XCode with human interaction, is better to build the app with the target option, like this:

```
xcodebuild -xcconfig "cordova/build.xcconfig" -project "iHogar.xcodeproj" ARCHS="armv7 armv7" -target "iHogar" -configuration Debug -sdk iphoneos build VALID_ARCHS="armv7 armv7s" CONFIGURATION_BUILD_DIR="build/device"

```

It's important to have the certificate to sign the app installed in the keychain, and the related provisioning profile downloaded.
I know you got around your issue, but as this is quite recent, have you considered upgrading to Cordova 5.1.1. This will build and code sign the app without the need to go into XCode.