xcode 缺少依赖目标“CordovaLib(来自 CordovaLib.xcodeproj)”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40022185/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:27:25  来源:igfitidea点击:

Missing dependency target "CordovaLib (from CordovaLib.xcodeproj)"

iosxcodecordovaionic-framework

提问by Chawki Messaoudi

Missing dependency target "CordovaLib (from CordovaLib.xcodeproj)" When running ios with Xcode

使用 Xcode 运行 ios 时缺少依赖项目标“CordovaLib(来自 CordovaLib.xcodeproj)”

enter image description here

在此处输入图片说明

回答by manzapanza

For some reasons the xcode project was corrupted. Generally, to solve this kind of problems, you can try removing and re-adding the platform ios:

由于某些原因,xcode 项目已损坏。一般情况下,解决这类问题,可以尝试移除和重新添加平台ios:

ionic platform rm ios
ionic platform add ios
ionic build ios

Attention: Any changes that you applied directly from xcode will be lost and you will need to apply manually after you will have run these commands. Do a backup of platforms/iosbefore.

注意:您直接从 xcode 应用的任何更改都将丢失,您需要在运行这些命令后手动应用。做platforms/ios之前的备份。

回答by Hymansonkr

A different solution

不同的解决方案

Before reading thisMAKE SURE you are opening YourProject.xcworkspaceand NOT YourProject.xcodeproj

在阅读本文之前,请确保您正在打开YourProject.xcworkspace而不是YourProject.xcodeproj

I couldn't get this to work using @manzapanza 's solution

我无法使用 @manzapanza 的解决方案使其正常工作

The Problem

问题

CordovaLib.xcodeprojis missing from your xcode project

CordovaLib.xcodeproj您的 xcode 项目中缺少

Solution(for mac users)

解决方案(适用于mac用户)

Download a copy of CordovaLib.xcodeproj and drag it into your xcode project.

下载 CordovaLib.xcodeproj 的副本并将其拖到您的 xcode 项目中。

  • $ sudo npm install -g cordova(installs a "global" copy of cordova to your computer, you might be able to skip this step)
  • $ find ~/ -name 'CordovaLib.xcodeproj'(mine was at /Users/Hymanson//.cordova/lib/npm_cache/cordova-ios/4.3.1/package/tests/spec/unit/fixtures/ios-config-xml/CordovaLib/CordovaLib.xcodeproj)
  • Open folder the folder path found above $ open [path](open /Users/Hymanson//.cordova/lib/npm_cache/cordova-ios/4.3.1/package/tests/spec/unit/fixtures/ios-config-xml/CordovaLib/)
  • Drag CordovaLib.xcodeprojto your xcode project
  • $ sudo npm install -g cordova(将cordova 的“全局”副本安装到您​​的计算机,您可以跳过此步骤)
  • $ find ~/ -name 'CordovaLib.xcodeproj'(我的在 /Users/Hymanson//.cordova/lib/npm_cache/cordova-ios/4.3.1/package/tests/spec/unit/fixtures/ios-config-xml/CordovaLib/CordovaLib.xcodeproj)
  • 打开上面找到的文件夹路径的文件夹$ open [path](打开/Users/Hymanson//.cordova/lib/npm_cache/cordova-ios/4.3.1/package/tests/spec/unit/fixtures/ios-config-xml/CordovaLib/)
  • 拖动CordovaLib.xcodeproj到您的 xcode 项目

This is what your file navigator should look like at this point:

这就是您的文件导航器此时的样子:

xcode example

代码示例

  • Delete red(missing) file
  • Select your app in the navigator (very top of file tree). Go to Targets > [Your Project Name] > Build Phases > Link Binary With Libraries > "+"
  • type in / look for libCordova.aand add it
  • Compile project
  • 删除红色(丢失)文件
  • 在导航器中选择您的应用程序(文件树的最顶部)。转到目标 > [您的项目名称] > 构建阶段 > 将二进制文件与库链接 > "+"
  • 输入/查找libCordova.a并添加它
  • 编译项目

回答by SaurabhRode007

I downgraded my Cordova version to 6.2.0 and it started working.

我将我的 Cordova 版本降级到 6.2.0 并开始工作。

回答by BernaAsis

Same solution for Apache Cordova project.

Apache Cordova 项目的相同解决方案。

Remove platform and re-add:

删除平台并重新添加:

cordova platform remove ios  
cordova platform add ios  
cordova prepare ios    
cordova run ios 

Successful!

成功的!

回答by Anilof

I had multiple issues with my app that I was able to resolve when I was missing CordovaLib from my XCode project.

我的应用程序有多个问题,当我的 XCode 项目中缺少 CordovaLib 时,我能够解决这些问题。

First I ran

首先我跑了

cordova requirements ios

and found that I was missing ios-deploy and CocoaPods. These were not requirements for Cordova 6.2.0 but are as of Cordova 6.4.0. I did not try 6.3.0 so I do not know the status for that version.

并发现我缺少 ios-deploy 和 CocoaPods。这些不是 Cordova 6.2.0 的要求,而是 Cordova 6.4.0 的要求。我没有尝试 6.3.0,所以我不知道那个版本的状态。

In addition, I had some icon files in my config.xml for iOS that did not exist because I was using a 3rd party cordova-icon maker to generate them and the fact that they were missing was apparently breaking the add platform command mid-process. Again 6.2.0 did not have this issue with the same config file, but 6.4.0 is definitely strict about not having any errors. My guess is that they were either continuing past the errors in prior version of Cordova or they re-arranged the way things are built so that the CordovaLib is now last and if there are any errors before that step, you will be missing the folder and its contents.

此外,我在 iOS 的 config.xml 中有一些不存在的图标文件,因为我使用第 3 方cordova-icon 制造商来生成它们,而它们丢失的事实显然破坏了添加平台命令的中间过程. 同样,6.2.0 没有使用相同的配置文件出现此问题,但 6.4.0 绝对严格要求没有任何错误。我的猜测是他们要么继续解决先前版本的 Cordova 中的错误,要么他们重新安排了构建方式,以便 CordovaLib 现在是最后一个,如果在该步骤之前有任何错误,您将丢失该文件夹并且其内容。