Failed to generate release build of cordova ios app

Shashi picture Shashi · Nov 5, 2013 · Viewed 7.6k times · Source

I am using phonegap CLI 3.1 and XCode5. I am trying to generate the build for release mode through Phonegap CLI and Xcrun. I don't want to use Phonegap Build to upload the mobileprovision or whatever the process of them. I want to do it by xcrun to assign the mobileprovison to release build.

1) cordova build ios --release

Compiling app on platform "ios" via command "/Applications/MAMP/htdocs/MyTest/MyTestApp/platforms/ios/cordova/build" --release Platform "ios" compiled successfully.

2) sudo xcrun -sdk iphoneos PackageApplication -v "ios/build/emulator/MyTestApp.app" -o "/Users/mymac/Desktop/Testnew/MyTestApp.ipa" --sign "iPhone Distribution: NAME (TEAM_ID)" --embed "MyTestApp_Dis.mobileprovision"

Packaging application: 'ios/build/emulator/MyTestApp.app' Arguments: embed=MyTestApp_Dis.mobileprovision verbose=1 output=/Users/mymac/Desktop/Testnew/MyTestApp.ipa sign=iPhone Distribution: NAME (TEAM_ID)
Environment variables:
HOME = /Users/mymac
SUDO_GID = 20
SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
VERSIONER_PERL_PREFER_32_BIT = no
MAIL = /var/mail/root
SSH_AUTH_SOCK = /tmp/launch-zsBMC8/Listeners
LANG = en_US.UTF-8
USER = root
LOGNAME = root
__CF_USER_TEXT_ENCODING = 0x0:0:0
USERNAME = root
PATH = /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
SUDO_USER = mymac
SHELL = /bin/bash
TERM = xterm-256color
SUDO_COMMAND = /usr/bin/xcrun -sdk iphoneos PackageApplication -v ios/build/emulator/MyTestApp.app -o /Users/mymac/Desktop/Testnew/MyTestApp.ipa --sign iPhone Distribution: NAME (TEAM_ID) --embed MyTestApp_Dis.mobileprovision
SUDO_UID = 501
VERSIONER_PERL_VERSION = 5.12

Output directory: '/Users/mymac/Desktop/Testnew/MyTestApp.ipa'
Temporary Directory: '/tmp/W81FhZ9VAH' (will NOT be deleted on exit when verbose set)
+ /bin/cp -Rp ios/build/emulator/MyTestApp.app /tmp/W81FhZ9VAH/Payload
Program /bin/cp returned 0 : []

Checking original app

  • /usr/bin/codesign --verify -vvvv ios/build/emulator/MyTestApp.app
    Program /usr/bin/codesign returned 1 : [ios/build/emulator/MyTestApp.app: code object is not signed at all
    In architecture: i386
    ] Codesign check fails : ios/build/emulator/MyTestApp.app: code object is not signed at all In architecture: i386

Done checking the original app

Embedding 'MyTestApp_Dis.mobileprovision'

  • /bin/rm -rf /tmp/W81FhZ9VAH/Payload/MyTestApp.app/embedded.mobileprovision Program /bin/rm returned 0 : []
  • /bin/cp -rp MyTestApp_Dis.mobileprovision /tmp/W81FhZ9VAH/Payload/MyTestApp.app/embedded.mobileprovision Program /bin/cp returned 0 : []
  • /usr/bin/codesign -d --entitlements /tmp/W81FhZ9VAH/entitlements_rawixGWnKhi /tmp/W81FhZ9VAH/Payload/MyTestApp.app Program /usr/bin/codesign returned 1 : [/tmp/W81FhZ9VAH/Payload/MyTestApp.app: code object is not signed at all ]
    error: Failed to read entitlements from '/tmp/W81FhZ9VAH/Payload/MyTestApp.app'

Answer

Juergen Klasen picture Juergen Klasen · Dec 2, 2013

Hmmh, I'm having a similar problem like Shashi.

When running 'cordova buld ios [--release]' from shell and then doing a 'xcrun ...' afterwards it works for me okay.

BUT: When running this sequence from within a script, I receive a "Codesign check fails ..." error too ...

If I insert (like) a "wait" cycle inside my script between the cordova and the xcrun call, it works.

So - to me - it seems, as if cordova returns to shell while it isn't completely finished (?)

Fact is if I code my script like

#!/bin/bash
cordova build ios --release
sleep 5
sh -c "xcrun ..."

it's working for me. Question: Is it a bug in cordova/phonegap ???