Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't generate release build for Cordova iOS App

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

like image 299
Aarush Avatar asked Nov 06 '13 14:11

Aarush


People also ask

Does Cordova work for iOS?

Cordova iOS is an iOS application library that allows for Cordova-based projects to be built for the iOS Platform.

How do I run a Cordova project in Xcode?

Table of Contents Getting Started Pre-requisites Steps : Create New SPRING MVC Project Add Required Dependecies Servlet Configuration Add Required Bean Classes Create Model,DAO,Service,Controller Packages Create Model Class Create DAO Class Create Service Class Create Controller Class Create a JSP page Run On Server ...


1 Answers

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.

like image 55
coolphon Avatar answered Oct 18 '22 15:10

coolphon