Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Cordova/CDVViewController.h' file not found when run in Xcode terminal

So when I am trying to build my code from xcode terminal it is failing and giving me an error of 'Cordova/CDVViewController.h' file not found but when I am building this from xcode then it is building just fine.

In my Xcode, I've done the whole Cordova sub directory thing Upgrade Cordova. Also when I ran list. This is what I see below:

xcodebuild -list

Information about project "myProject":

Targets:
    myProject

Build Configurations:
    Debug
    Release

If no build configuration is specified and -scheme is not passed then "Release" is used.

Schemes:
    myProject
    CordovaLib

Environment: Xcode5, OS 10.8.5

Is there anything I am missing? The reason why I am doing this because I am trying to run this through jenkins. I thought it was a jenkins issue but then I got it down to the xcode terminal not seeing the CordovaLib.

like image 938
maridob Avatar asked Nov 01 '13 14:11

maridob


2 Answers

I've spent too much time figuring out the solution for this so it is a shame not to share. There can be many possible reasons why this problem arise but if you feel like you've set up everything right in the CordovaLib (like me!) and still has the same problem. This can be one of the causes. What's happening is when I ran the

 xcodebuild  -scheme myProject -configuration "Release"

it is building successfully, but if you don't supply "-scheme" it it will fail by default it is using the "Release". The parameters of the scheme will control which targets are built and how they are built, myProject scheme contains the subfolder and reference to Cordovalib.

Now, moving to Jenkins, is you need to supply the scheme in the "Xcode Schema File" text box in the Advanced Xcode build options section of the XCode Plugin.

My set-up is Xcode as my slave but this may still apply to whatever Xcode and Jenkins combination you have - so when I ran the

 xcodebuild  -list

I receive the message the following message:

If no build configuration is specified and -scheme is not passed then "Release" is used.

This project contains no schemes.

The solution for this is, in your xcode project, go to Product|Scheme|Manage Scheme and checked "Shared" to both projects myProject and CordovaLib. Compile. Check-in (because I am grabbing this from TFS). Ran again the "-list" command and you will see the schemes that you just shared.

Hope this helps!

like image 51
2 revs Avatar answered Jun 11 '23 07:06

2 revs


Thanks a lot ! Just adding "-scheme" and "-configuration" parameters fixed the problem for me.

If it can help someone else, here is the full command line i used :

xcodebuild -scheme MyProject -configuration "Release" -arch i386 -sdk iphonesimulator7.1

I used it to generate a ios simulator build in order to submit an Phonegap / Cordova application to the Facebook Review

like image 21
Simon Baudry Avatar answered Jun 11 '23 08:06

Simon Baudry