Can't generate release build for Cordova iOS App

14,010

The problem is that you do not have proper schemes. When phonegap project is generated it does not contain any schemes and thus linking to the phonegap files is incorrect.

Go to the phonegap generated project in console and put 'xcodebuild -list' in the output you will get that there is no schemes in the project.

Open generated by phonegap project in the xcode - this will generate schemes.

Now you can build this using xcodebuild(Remember to fill up the proper scheme name):

xcodebuild -scheme YOURSCHEMENAME -project MyApp.xcodeproj -alltargets -sdk iphoneos7.0 PROVISIONING_PROFILE="PROFILE_UUID.mobileprovision" -configuration Release

For continous integration this is bad solution because you have to launch the xcode GUI to generate the schemes but I did not found any other solution for this problem. If someone know how to generate scheme using command line it would be nice of him to write it down.

Share:
14,010

Related videos on Youtube

Aarush
Author by

Aarush

Developed Mobile Applications using Phonegap(Cordova) for Android and iOS platform.

Updated on September 16, 2022

Comments

  • Aarush
    Aarush over 1 year

    I am using Phonegap CLI 3.1 and XCode5. I want to generate the release build for iPhone Application through command line, I have valid distribution certificate and mobile provisioning profile. I want to generate the release build totally through command and don't want to use XCode GUI or Phonegap Build. I have tried too much with xcodebuild, xcrun and even corodva build command but none of them provide me the release build file (either in .app format or .ipa).

    Method 1 (Use xcodebuild)

    a) xcodebuild -project MyApp.xcodeproj -alltargets -sdk iphoneos7.0 PROVISIONING_PROFILE="PROFILE_UUID.mobileprovision" -configuration Release
    

    ** BUILD FAILED **
    The following build commands failed:

    CompileC build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv7/AppDelegate.o MyApp/Classes/AppDelegate.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler

    CompileC build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv7/MainViewController.o MyApp/Classes/MainViewController.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler

    CompileC build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv7s/AppDelegate.o MyApp/Classes/AppDelegate.m normal armv7s objective-c com.apple.compilers.llvm.clang.1_0.compiler
    (3 failures)


    Method 2 (Use corodova build and xcrun to sign the app)

    a) cordova build ios -release
    

    Compiling app on platform "ios" via command "/Users/Macuser/Desktop/MyApp/platforms/ios/cordova/build" --release Platform "ios" compiled successfully.

    b) xcrun -sdk iphoneos PackageApplication -v "build/Release-iphoneos/MyApp.app" -o "build/Release-iphoneos/MyApp.ipa" --sign "iPhone Distribution: NAME (ID)" --embed "PROFILE_UUID.mobileprovision"
    

    error: Failed to read entitlements from '/tmp/iyibGn3aUv/Payload/MyApp.app

  • Aarush
    Aarush over 10 years
    As i have mentioned already i don't want to use xcode gui features. I know how to build app for release and Adhoc using XCode GUI. I don't want to open the xcode. I want to do the same using command line. like use xcodebuild, xcrun or cordova build command.
  • msrameshp
    msrameshp almost 10 years
    did you figure out a solution for this ?. I am facing the same issue. Any help is highly appreciated.
  • Captain Obvious
    Captain Obvious almost 10 years
    @coolphon is there a way to generate the schemes using commandline? I'm trying to automate the building so i can't really do something like 'open en close xcode'..
  • ssmith
    ssmith over 9 years
    You can generate the schemes automatically by using the xcodeproj Ruby gem (ie: gem install xcodeproj) and the following tiny script gist.github.com/shanesmith/8b88720c19b910cc9900
  • escapedcat
    escapedcat over 9 years
  • Raghav
    Raghav over 9 years
    I have project where the schemes are created from GUI and shared, when I run the xcodebuild command its not working showing the coredova is not found.Is there any solution for coredova projects?
  • Alon Amir
    Alon Amir almost 9 years
    I wasted HOURS of my life realising the xcodebuild process is stuck in my jenkins just because I didn't open it up to generate the schemes. Thank you, and @ssmith !
  • Marc
    Marc about 8 years
    Apparently you can't use -alltargets when specifying a -scheme on the command line.