问题
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!
回答1:
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
- Re-install cordova from brand new installation, explicitly install the command line tools on the latest version of Xcode (quit Xcode before doing this)
- Copy your old projects www folder into the new command line created www folder after deleting everything it presently contains
- 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.
回答2:
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..
回答3:
After trying every solution I could find (including the ones Jonathan posted for this question) with no success I have solved my problem. Hopefully this answer added to the list of others will help someone else. If my answer does not apply to your similar situation please check out the list below posted by Jonathan which is a comprehensive list of other possible solutions.
My somewhat unique situation: In a pre 2.0 version of Phonegap (when I was able to compile) I had created a custom build configuration for AdHoc and AppStore. The defaults we have are "Debug" and "Release" and my two custom configurations were created so I didn't have to switch the code signing certificates when I switched from an AppStore release to an AdHoc build.
The problem/solution: In post 2.0 Phonegap we've got an instance of CordovaLib.xcodeproj subproject (this is new)... which means if I'm going to use a custom build in my main project I have to add that custom build configuration in this subproject as well.
Project Navigator >> Click CordovaLib.xcodeproj >> Click on the project CordovaLib >> Configurations >> make sure whichever build you are going to use exists (by name) in this list. No further configuration is necessary assuming you've already dealt with this in your main project having created these custom build configurations in the past.
回答4:
I encountered this problem when using Cordova 2.7.0 on xcode 4.6.2 and fixed it by changing the setting for the build location for derived data:
Go to xcode->preferences Clicked advanced button under derived data Select unique
The reason I encountered this problem was because I was restarting a new 'version' of an old project as a new project in xcode, and after creating it I changed the bundle identifier to match my old project (Doing this allows you to submit your new project as an update of your old project in the app store). The default setting for derived data was Legacy, so it was looking for the cordova files using the original bundle identifier, not the new one.
Hope this helps someone that may encounter something similar
来源:https://stackoverflow.com/questions/13883471/phonegap-cdvviewcontroller-h-not-found-when-archiving-for-distribution