I added Cordova as a component to my iOS project. Adding a custom plugin leads to the error, despite that the plugin works in a Cordova-only project:
\'CDVPl
I have spent awful lot of time trying to fix the same issue in my project, so let me share my findings. It might be relevant for those who are able to build the project in one configuration, but in another configuration (e.g. when building unit tests) precompiler fails to find CDVPlugin.h
.
You have to make sure that CordovaLib
sub-project has the same set of configurations as your main project.
Info
tab.Configurations
.So, this is a set of your app configurations. In my example it looked like this:
You need to have the same set of configurations in your CordovaLib
sub-project.
CordovaLib
sub-project.Info
tab.Configurations
.+
button.Duplicate "Release" Configuration
Now perform a clean build.
Click on the project icon in the Project Navigator,
select your Project, then select the "Build Settings" tab
Enter "Header Search Paths" in the search field
Add "$(CORDOVALIB)/Classes"
and check the Recursive checkbox - for the Header Search Paths value
optional
Add "-all_load"
and "-Obj-C"
- for the Other Linker Flags value
see detailed description (step 17)
Note: Phonegap 2.9.1 (Nov 2013))
I encountered the same problem while trying to make an open source "C" phone gap plugin work. The solution was to add the Cordovalib.xcodeproj to the target project, once done, click on your_project.xcodeproj - you will need to look in the Target Settings, under the Build Phases Tab, make sure that Cordovalib is added in Target Dependencies.
Once done it should allow the statement: #import to work.