简体   繁体   English

离子 ios 构建失败,找不到错误存档

[英]Ionic ios build fails, error archive not found

I've been trying to figure this out, but there doesn't seem to be any light at the end of the tunnel, thus trying it here...hope you can help.我一直在试图解决这个问题,但隧道尽头似乎没有任何光线,因此在这里尝试......希望你能帮上忙。

I have an Ionic project.我有一个离子项目。 Running via ionic serve gives me the result I expect, no problem there.通过ionic serve运行给了我预期的结果,没问题。 However, when running a command like ionic cordova run ios -lc , I receive an error breaking the build process.但是,当运行像ionic cordova run ios -lc这样的命令时,我收到一个错误,中断了构建过程。 The error I receive is the following:我收到的错误如下:

[cordova] error: archive not found at path '/Users/path-to-app/platforms/ios/demoapp.xcarchive' [cordova] ** EXPORT FAILED ** [cordova] [cordova] (node:5866) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error code 65 for command: xcodebuild with args: -exportArchive,-archivePath,demoapp.xcarchive,-exportOptionsPlist,/Users/path-to-app/platforms/ios/exportOptions.plist,-exportPath,/Users/path-to-app/platforms/ios/build/device [cordova] (node:5866) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I see 2 different errors here: archive not found and a deprecation problem.我在这里看到 2 个不同的错误:找不到存档和弃用问题。 Don't know which one is breaking the build but can't seem to find a solution for either one of them.不知道哪个破坏了构建,但似乎无法为其中任何一个找到解决方案。

Ionic info:离子信息:

Ionic:

   ionic (Ionic CLI)  : 4.1.2
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0, browser 5.0.4, ios 4.5.5
   Cordova Plugins       : no whitelisted plugins (0 plugins total)

System:

   Android SDK Tools : 25.1.7 (/Users/Vincent/Library/Android/sdk)
   ios-deploy        : 1.9.2
   NodeJS            : v9.1.0 (/usr/local/bin/node)
   npm               : 6.4.1
   OS                : macOS High Sierra
   Xcode             : Xcode 10.0 Build version 10A255

Any help would be appreciated!任何帮助,将不胜感激!

Currently cordova-ios is not compatible with Xcode 10目前cordova-ios与Xcode 10不兼容

You can try to disable the new build system that Xcode 10 uses and use the old one by adding this to your build.json file您可以尝试禁用 Xcode 10 使用的新构建系统并通过将其添加到 build.json 文件来使用旧构建系统

"buildFlag": [
  "-UseModernBuildSystem=0"
]

or adding --buildFlag="-UseModernBuildSystem=0" to the build command或在构建命令中添加--buildFlag="-UseModernBuildSystem=0"

The full command should be cordova build ios --buildFlag="-UseModernBuildSystem=0" .完整的命令应该是cordova build ios --buildFlag="-UseModernBuildSystem=0"

Or for Ionic ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"或者对于 Ionic ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"

In addition to the above answer given by @jcesarmobile, another solution is to build the app with the Ionic CLI by executing the following command:除了@jcesarmobile 给出的上述答案之外,另一种解决方案是通过执行以下命令使用 Ionic CLI 构建应用程序:

ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"

According to the documentation of the ionic build command, to pass additional options to the Cordova CLI you should use the -- separator after the Ionic CLI arguments.根据ionic build命令的文档,要将其他选项传递给 Cordova CLI,您应该在 Ionic CLI 参数之后使用--分隔符。 The execution of the build command through Ionic CLI instead of Cordova CLI will also build web assets and provide friendly checks before cordova merely builds the app.通过 Ionic CLI 而不是 Cordova CLI 执行build命令也将构建 Web 资产并在cordova 仅仅构建应用程序之前提供友好的检查。

An Example for a working build.json (to place into your cordova / ionic project root directory) is the following content:一个工作 build.json 的示例(放置到您的cordova / ionic项目根目录中)是以下内容:

 {
  "ios": {
    "debug": {
      "buildFlag": [
        "-UseModernBuildSystem=0"
      ]
    },
    "release": {
      "buildFlag": [
        "-UseModernBuildSystem=0"
      ]
    }
  }
}

For more parameters about build.json see also cordova doc: https://cordova.apache.org/docs/en/latest/guide/platforms/ios/有关 build.json 的更多参数,请参阅cordova 文档: https ://cordova.apache.org/docs/en/latest/guide/platforms/ios/

The command suggested by jcesarmobile didn't work for me, but doing jcesarmobile建议的命令对我不起作用,但正在做

cordova build ios --buildFlag="-UseModernBuildSystem=0"

(without ionic) succesfully completed the build. (没有离子)成功完成构建。

After that I've been able to do ionic cordova build ios without any problems.在那之后,我已经能够毫无问题地进行 ionic cordova build ios。 (even without the buildFlag) . (即使没有 buildFlag) I'm not an expert in this, in fact it was a mistake not to include ionic lol.我不是这方面的专家,事实上,不包括离子笑是一个错误。 So, although everything seems to work ok i'm not sure if there are any drawbacks in building with only cordova for the first time.因此,尽管一切似乎都正常,但我不确定第一次仅使用cordova 进行构建是否有任何缺点。 Maybe someone can throw some light in the comments也许有人可以在评论中提出一些看法

Hope this is still helpful.希望这仍然有帮助。

A couple of Pitfalls: Preparing the XCODE file.几个陷阱:准备 XCODE 文件。

It's time to prepare the project to be opened in XCODE.是时候准备要在 XCODE 中打开的项目了。 However Ionic-Cordova doesn't support the NEW build system of XCODE.但是 Ionic-Cordova 不支持 XCODE 的新构建系统。 So the project has to be prepared for the Legacy build system.因此,项目必须为 Legacy 构建系统做好准备。 Pitfall #2.陷阱#2。 Important!重要的! Disconnect your iPhone or iPad device connected to the Mac or the following command won't work!!!断开连接到 Mac 的 iPhone 或 iPad 设备,否则以下命令将不起作用!!! Pitfall #3.陷阱#3。

ionic cordova build ios --prod --buildFlag='-UseModernBuildSystem=0'

Congrats!恭喜! Your MyApp.xcodeproj(ect) file is ready.您的 MyApp.xcodeproj(ect) 文件已准备就绪。 You're almost half way to have an IPA uploaded.您已上传 IPA 快一半了。 Just double click on the Myapp.xcodeproj file or open it through XCODE.只需双击 Myapp.xcodeproj 文件或通过 XCODE 打开它。 显示 XCODE 的图片

There are several other pitfalls you will find:您还会发现其他几个陷阱:

  • It's a common Pitfall#4 to not have the proper privilege set.没有正确的权限集是一个常见的陷阱#4。 In particular the rol “Developer” (Pitfall#4.1) doesn't have privileges to push Apps to the Store特别是角色“Developer”(陷阱#4.1)没有将应用程序推送到商店的权限
  • Double check that the “Bundle Identifier” is exactly the one you set in the config.xml file!仔细检查“Bundle Identifier”是否与您在 config.xml 文件中设置的完全一致!
  • XCODE exposes a Signing bug, Pitfall#5, so untick the “Automatically manage signing” and tick again. XCODE 暴露了一个签名错误,陷阱#5,所以取消勾选“自动管理签名”并再次勾选。 You will face this bug for sure.你肯定会遇到这个错误。

XCODE bugs and Cordova not supporting properly the new building system leads to all these issues. XCODE 错误和 Cordova 无法正确支持新的构建系统会导致所有这些问题。 I made a full guide showing how to fix them after lurking hours.我做了一个完整的指南,展示了如何在潜伏数小时后修复它们。 Hope it helps!希望能帮助到你!

In My case I have to specify the swift compiler version and workspace settings in XCODE 10.2.1在我的情况下,我必须在XCODE 10.2.1 中指定 swift 编译器版本和工作区设置

NOTE : In my project I have installed Onesignal plugin注意:在我的项目中,我安装了 Onesignal 插件

First I specified the swift compiler version.首先我指定了 swift 编译器版本。

  1. Open the myproject-name.workspace file because cocoapods installed.打开myproject-name.workspace文件,因为安装了 cocoapods。
  2. Go to Build Settings Tab in xcode.转到 xcode 中的构建设置选项卡。
  3. Scroll very bottom of the build settings tab find Swift Compiler - Language .滚动构建设置选项卡的最底部,找到Swift Compiler-Language
  4. Select the Swift version from the Swift Language Version drop down (Ex : Swift 4).Swift 语言版本下拉列表中选择 Swift 版本(例如:Swift 4)。

Then Change the workspace setting然后更改工作区设置

  1. Go to Xcode File Menu转到 Xcode文件菜单
  2. Select Workspace Settings选择工作区设置
  3. Select Legacy Build System from the Build System drop down从 Build System 下拉列表中选择Legacy Build System
  4. Click Done点击完成

And after all try to rebuild with following command in terminal毕竟尝试在终端中使用以下命令重建

ionic cordova build ios

Just try below command:只需尝试以下命令:

ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"离子科尔多瓦构建 ios -- --buildFlag="-UseModernBuildSystem=0"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM