8

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

enter image description here

Chawki Messaoudi
  • 714
  • 2
  • 6
  • 18

5 Answers5

15

A different solution

Before reading this MAKE SURE you are opening YourProject.xcworkspace and NOT YourProject.xcodeproj

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

The Problem

CordovaLib.xcodeproj is missing from your xcode project

Solution (for mac users)

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

  • $ 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/Jackson//.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/Jackson//.cordova/lib/npm_cache/cordova-ios/4.3.1/package/tests/spec/unit/fixtures/ios-config-xml/CordovaLib/)
  • Drag CordovaLib.xcodeproj to your xcode project

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.a and add it
  • Compile project
Community
  • 1
  • 1
Jacksonkr
  • 31,583
  • 39
  • 180
  • 284
  • I'm sorry for being so lame but may I ask you to specify what folder you dragged CordovaLib.xcodeproj into in the whole project? Thx. – Ric Mar 30 '17 at 08:24
  • @Ric I'm not sure what you mean. So I dragged it below the "red" CordovaLib.xcodeproj. You should get a popup where you can select the target and even a "copy" option at the top which will copy the files over to your current project. Also, if you're opening a `.xcodeproj` try opening the `.xcworkspace` instead and that may fix your problem. – Jacksonkr Mar 30 '17 at 14:01
  • Yes, I was assuming you had dragged the folder into a folder of your project, via Finder or Win Explorer, versus a reference in XCode. I followed your method, thx. – Ric Mar 30 '17 at 22:48
  • 1
    Uninstalled and installed almost everything except Mac OS itself but nothing worked :D. This should be the accepted answer. – Devang Oct 25 '17 at 14:07
12

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:

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/ios before.

manzapanza
  • 6,087
  • 4
  • 39
  • 48
4

Same solution for Apache Cordova project.

Remove platform and re-add:

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

Successful!

Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
BernaAsis
  • 56
  • 2
3

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

jww
  • 97,681
  • 90
  • 411
  • 885
2

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

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.

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.

Anilof
  • 326
  • 2
  • 7