可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm currently using Phonegap 2.0 to develop an iOS App in XCode. The app builds and runs fine in the emulator and also on the testing devices.
The problem appears when I try to archive the app for distribution. The archive fails with the following message:
CDVViewController.h file not found.
Any ideas?
回答1:
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
1.Double click the
and you can add this in.
2.Change $(OBJROOT)/UninstalledProducts/include
to $(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include

回答2:
On Xcode 7.1, you would need to update header search paths
field from $(OBJROOT)/UninstalledProducts/include
to $(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include
You can find header search paths
under build settings
-> search paths
回答3:
Managed to fix it.
These were missing from "Header Search Path" in the build setting of my TARGET settings:
"$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(BUILT_PRODUCTS_DIR)"
Get the solution form multiple sources:
Upgrading Cordova iOS (Stepts from 31) http://docs.phonegap.com/en/2.0.0/guide_upgrading_ios_index.md.html#Upgrading%20Cordova%20iOS
Bug report https://issues.apache.org/jira/browse/CB-1122
Discussion at groups.google.com/forum/?fromgroups=#!topic/phonegap/IcR8-ijrUfk
Discussion at groups.google.com/forum/?fromgroups=#!topic/phonegap/PzqZEm8QKmc
回答4:
For future ref:
I just fixed this exact problem for myself.
If you are using Cordova cli, and have your config.xml updated, you can just remove ios as a platform and add it back. Then archive again from XCode.
cordova platform remove ios cordova platform add ios
Hope that helps, worked perfectly for me,
回答5:
I was experiencing the exact same problem. I believe it may have been introduced because I moved the location of the Xcode project after I created it with Cordova's tools. Or, it may also be possible that I didn't properly setup the Cordova iOS toolset - perhaps I didn't run the installer package (I've rebuilt this machine a couple of times). Also, all the related answers I found with Google suggested I needed to change some of Cordova's core classes - which I wasn't willing to do.
My solution was to use the Cordova create
command to build an entirely new Xcode project. I copied my original project's www
directory into the new project and then went about re-configuring the new project to match the settings of the original project.
The new project, using the same plugins, frameworks and build settings successfully built an archive whereas the original project could not. It's not an ideal solution - but it worked.
回答6:
I was facing the same issue when copying my project to another folder. I'm using Phonegap 2.0.0. After trying several solutions without success, I ran Product->Clean and everything worked properly. Do not ask me why but this path already solved several small glitches that I had to deal with, i.e. changing splash and icon files, who was not updated on device. Hope this help.
回答7:
As is sometimes the case, an accepted solution may not help everyone with a similar but perhaps unrelated issue.
My observation was similar (CDVViewController.h not found). First ensure the TARGET settings includes "header search paths" as described above.
Then follow this link to what worked for me: http://outof.me/embedding-cordovalib-in-your-iosphonegap-app-project/
Essentially I needed to re-link cordova as a target dependency and then Link it to my libraries.
THEN, If you migrated to cordova 2.5.0, you will likely run into an issue that spits out something similar to this: ""_ALAssetPropertyDate", referenced from:
___23-[CDVFile getMetadata:]_block_invoke in libCordova.a(CDVFile.o) ___27-[CDVFile getFileMetadata:]_block_invoke in libCordova.a(CDVFile.o)
"_OBJC_CLASS_$_ALAssetsLibrary", referenced from:
objc-class-ref in libCordova.a(CDVFile.o) objc-class-ref in libCordova.a(CDVFileTransfer.o) objc-class-ref in libCordova.a(CDVURLProtocol.o)
"
If os, add the AssetLibrary framework and have some peace.
回答8:
$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include
Adding this to the "Search Paths" section in "Build Settings" work perfectly.
Search Paths in XCode Build Settings
回答9:
You may need to update your CordovaLib sub-project reference.
Launch Terminal Go to the location where you installed Cordova in the bin sub-folder. For example, /Users/Shared/Cordova/phonegap-2.2.0/lib/ios/bin
Run the command below where the first parameter is the path to your project's .xcodeproj file:
./update_cordova_subproject /path/to/your/project
回答10:
Xcode 7.2 is a little different
$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include
needs to be put in the header search paths for debug and for release.