ios - 无法为 Cordova iOS App 生成发布版本

标签 ios xcode cordova xcodebuild xcrun

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).

方法一(使用xcodebuild)

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

** 构建失败 **
以下构建命令失败:

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 .编译器

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 .编译器

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 .编译器
(3 次失败)


方法二(使用corodova build和xcrun对app进行签名)

a) cordova build ios -release

通过命令“/Users/Macuser/Desktop/MyApp/platforms/ios/cordova/build”在平台“ios”上编译应用程序——发布平台“ios”编译成功。

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"

错误:无法从“/tmp/iyibGn3aUv/Payload/MyApp.app”读取权利

最佳答案

问题是你没有合适的方案。生成 phonegap 项目时,它不包含任何方案,因此链接到 phonegap 文件是不正确的。

在控制台中转到 phonegap 生成的项目并输入“xcodebuild -list” 在输出中,您将看到项目中没有方案。

在 xcode 中打开由 phonegap 项目生成的 - 这将生成方案。

现在您可以使用 xcodebuild 构建它(记得填写正确的方案名称):

xcodebuild -scheme YOURSCHEMENAME -project MyApp.xcodeproj -alltargets -sdk iphoneos7.0 PROVISIONING_PROFILE="PROFILE_UUID.mobileprovision"-配置发布

对于持续集成,这是一个糟糕的解决方案,因为您必须启动 xcode GUI 才能生成方案,但我没有找到解决此问题的任何其他解决方案。如果有人知道如何使用命令行生成方案,最好将其写下来。

关于ios - 无法为 Cordova iOS App 生成发布版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19814092/

相关文章:

ios - 在iphone sdk中如何在屏幕打开时使用前置摄像头拍照

iphone - ios 应用程序崩溃时 "lock screen"

xcode - 将 Dragon (MacSpeech) 与 XCode 配合使用?

javascript - 服务器以 ""的非 JavaScript MIME 类型响应

android - cordova navigator.camera.getPicture 在 android 中不工作

cocoa - 将 iOS 移植到 Mac,创建 GUI、HOMEKIT 还是 Chameleon?

iphone - UITableView 还是 UITableViewCell?提示 "Thread 1: Program received signal: "SIGABRT”

macos - ionic :Error: Failed to fetch platform android in Mac?

ios - 使用无声通知更新屏幕

ios - 将.ipa从发行版转移到开发者资料