Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap CDVViewController.h not found when archiving for distribution

I am experiencing this issue in version 2.2 of Cordova/Phonegap in Xcode 4.5.2. This is a new project - so right off the bat without anything in the www folder modified. When I build in Debug mode everything goes fine. When I try to build for archiving in distribution mode (AdHoc or App store) I get this error:

'Cordova/CDVViewController.h' file not found

Is there any further information that I can post to help clarify the situation?

I have tried starting from scratch several times (as per the suggestion of some similar questions I've seen asked) as well as uninstalling and reinstalling Xcode for good measure. My Xcode derived data location is set to Unique (as per another similar question). I have also performed update_cordova_subproject on the project to no effect.

Thanks so much for any help here!

like image 356
PotatoFro Avatar asked Dec 02 '22 20:12

PotatoFro


2 Answers

I had the same problem a couple of weeks ago, I did some research in attempts to find the cause and solution to this but ended up trying different approaches and then suddenly and as randomly, it just worked. What exactly made it work - I cannot tell but I would suggest you to go for a trail and error approach and try out the following

I've listed the suggested solutions below in order of relevance (likelihood to solve your issue) as well as by complexity (ascending)

Approach 1

Go to BuildSettings > Header > Search Paths and add the following line:

$(OBJROOT)/UninstalledProducts/include

More info/suggestions can be found here

Approach 2

For some reason, it appears as if the dependencies in Cordova gets missing when upgrading to a new 2.x version of Cordova. This is assumed to the cause of Cordova 2.x having changed how the framework is referenced in iOS projects. Try following the steps of This article

Approach 3

If A1 and A2 fails to solve your issue, the error message you receive may be of somewhat misleading nature, forcing one to look at alternative approaches to other potential causes. Certificates and Code Signing identities would be the next place to look into. Try removing them from keychain/xcode, revoke them from within the Provisional Portal, recreate new ones and add them to your Xcode project. Try archiving and see if it works.

Approach 4

Make sure both your main project and the CordovaLib.xcodeproj are set to Build Active Architecture Only

Other suggestions

you may have tried one or more of these but just to make sure

  1. Re-install cordova from brand new installation, explicitly install the command line tools on the latest version of Xcode (quit Xcode before doing this)
  2. Copy your old projects www folder into the new command line created www folder after deleting everything it presently contains
  3. Keep an eye on the error console when running, see if there's any error that may further help to identify the origins of this issue.

Please let me know if neither of these proposed solutions solved your issue, then we'll just have to dig deeper until we find a working solution.

like image 114
Jonathan Avatar answered Dec 18 '22 22:12

Jonathan


Xcode 6.x

add $(OBJROOT)/UninstalledProducts/include to BuildSettings->Header Search Paths

Xcode 7.x

add $(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include to BuildSettings->Header Search Paths

it's work for me . hope it can help you..

like image 42
Allan Avatar answered Dec 18 '22 22:12

Allan