kousik kumar Ghosh
kousik kumar Ghosh

Reputation: 91

‘Cordova/CDV.h’ file not found in Xcode 8.2.1

I have one hybrid Cordova project, which is running fine Xcode 5.1.1, but when I am trying to Archive the project in Xcode 8.2.1 with ‘Generic iOS Device’ I am getting the error ‘Cordova/CDV.h’ is not found.

I read many articles about this problem, but none could solve my problem. Most answers are telling to follow the below steps:

"Add this line to your Build Settings -> Header Search Paths: $(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include "

I have did this but problem not solved, getting another error ‘ld: library not found for -lcrt1.3.1.o clang: error: linker command failed with exit code 1 (use -v to see invocation)’

Also I have changed the bitcode YES to NO in target Build Settings, but no fruitful result.

Project cordova version 3.4.0 where installed cordova version in machine 6.4.0

Has anybody experience with this kind of problem? Please, can anyone help? I've been working on this for days.

Upvotes: 9

Views: 11282

Answers (5)

Damini
Damini

Reputation: 11

1.clean all issues 2.clean build folders these two steps work for me.

Upvotes: 0

CodeChanger
CodeChanger

Reputation: 8371

I know its too late to answer on this question but still many developers facing the above issue and as per the latest Cordova & ionic version below steps will work in the above error.

As per new update in Cordova some time due to some permission issue or directly run or build iOS platform it's unable to add below file or folders in your iOS project platform :

CordovaLib

so somehow above folder will not add in your project and that's why it's not building your iOS project.

To overcome this issue you need to remove iOS platform from your ionic project and again add it.

Remove iOS platform: sudo ionic cordova platform remove ios

Add it again: sudo ionic cordova platform add ios

By doing this cordova download CordovaLib folder from server and add it into your iOS project and after that users can able to build their project without any error.

recently I faced this issue and I solved by doing the above steps.

Hope this helps others.

Happy coding!

Upvotes: 2

bob
bob

Reputation: 8005

Seems like the "Cordova" folder isn't getting copied into the project during cordova platform add ios

So, you'll have to copy the "Cordova" source folder into your project manually. But you'll have to download the ios source packages from github first, which is located at:

https://github.com/apache/cordova-ios

After downloading the "cordova-ios-master.zip" package and unzipping it, copy the folder named "CordovaLib" into your project next to the Xcode project file:

PROJECT_FOLDER/platforms/ios/PROJECT_NAME
PROJECT_FOLDER/platforms/ios/PROJECT_NAME.xcodeproj
PROJECT_FOLDER/platforms/ios/PROJECT_NAME.xcworkspace
PROJECT_FOLDER/platforms/ios/cordova
PROJECT_FOLDER/platforms/ios/CordovaLib   <------- here
PROJECT_FOLDER/platforms/ios/ios.json
PROJECT_FOLDER/platforms/ios/platform_www
PROJECT_FOLDER/platforms/ios/pods-debug.xcconfig
PROJECT_FOLDER/platforms/ios/pods-release.xcconfig
PROJECT_FOLDER/platforms/ios/www

Upvotes: 1

John Lynch
John Lynch

Reputation: 31

I wanted to report that the response provided by Vinay worked for me. I had to make sure I was in the share extension target, and I added it to the path exactly as suggested above in the Release option, and did not even have to do a clean to get it to regenerate the PCH.

BUT, I was puzzled by this after looking at the setting further and I realized this path was already in the setting. I edited it again, and removed the redundant path, hit 'run' again, and it loaded onto my iPhone and ran fine.

So, I believe that just setting this in the search path forced a recompile on the share extension PCH and all is working again.

I hope this helps others.

Upvotes: 2

Vinay Patil
Vinay Patil

Reputation: 77

I got it work by following below steps

  1. In your Xcode project settings select TARGETS
  2. Within TARGETS select the Build Settings tab
  3. In the sub-options under the Build Settings tab be sure to select All
  4. Scroll down to the Search Paths section
  5. Locate Header Search Paths
  6. Add the following configuration to the Release option (as a new value on its own line): $(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include
  7. Clean the project: Command + Shift + K
  8. Restart Xcode

Upvotes: 4

Related Questions