What most users know is that Phonegap (renamed Cordova) was restructured in version 2.0 to remove the installation DMG file from the download package. Instead, iOS users are now instructed to install PhoneGap through the terminal. While everything has been streamlined with a few installation scripts provided by the developers, it is different, and sometimes hard to tell if you installed everything correctly until you compile the application. Here are a few of the symptoms that I’ve seen from people who mess up the installation:
- libCordova.a is displayed in red when building the project
- argv6 errors at compile time
- Everything works in the Simulator, but does not build on an actual device
- CordovaLib.xcodeproj not found issues

Download and open the Phonegap 2.1 package from the official site. Open a terminal window, and cd to the installation directory, which is most likely ~\Desktop\phonegap-2.1\. Now run the following scripts:

As shown in the screenshot above, you need to first create a new project:
./create [project_folder_path] [package_name] [project_name]
Then you need to set the path to your libraries.
./update_cordova_subproject [xcodeproj file]
Now open up your project and set the deployment target to 4.3.

When you say, run the following scripts, are you really saying to run just the one script: ./update_cordova_subproject [xcodeproj file] ?
Which xcodeproj file do we put in place of [xcodeproj file] ?
Is this wording accurate, or are we supposed to replace something with something else: ./update_cordova_subproject ?
Look at the example in the screenshot. You use the xcodeproj file of the new project that you create with the ./create script right above.
It’s a two step process:
1. Run ‘create’
2. Run ‘update_cordova_subproject’
Phonegap-2.1 > ios > CordovaLib
Where do I put CordovaLib?
I’ve installed a bin into Document. It os ok.
That’s fine in Document. Now open a Terminal, navigate to the bin directory included within the download package, and run the ‘create’ and ‘update_cordova_subproject’ scripts.
You don’t actually install CordovaLib at all. The update script tells xCode where to find it.
UPDATE:
Phonegap-2.1 > ios > CordovaLib
Where do I put CordovaLib?
I’ve downloaded phonegap-phonegap-26d211b and that is the way I read it as it is directly from Phonegap. Do I rename a folder phonegap-2.1 for clarity?
I would rename it just cause typing all of that is annoying. Inside is the bin folder that you need.
I’ve followed all of the steps. CordovaLib.xcodeproj is linking correctly in Xcode 4.5. But…
CordovaLib.xcodeproj > Producs > libCordova.a is still red.
Build will fail with message ‘Cordova/CDVViewController.h’ file not found.
Any thoughts?
If it can’t find that file, you need to run the “update_cordova_subproject” again. Make sure you point it to the actual project file. That .h file is in the same project folder, which is how I know it’s not linked.
I installed a fresh xcodeproject called test.
desktop/junk/test/test.xcodeproj
loaded in xcode
changed version to 4.3
tried to compile but got the same error missing ‘Cordova/CDVViewController.h’
I tried running the update again, pointing to my text.xcodeproj file, no change
ideas?
What are the exact commands you ran in Terminal?
Thanks for the info. I tried it and notice a few things
1. my file is still red
2. when compiling for device or for archive i get the following error
“_OBJC_CLASS_$_CDVViewController”, referenced from:
_OBJC_CLASS_$_MainViewController in MainViewController.o
“_OBJC_METACLASS_$_CDVViewController”, referenced from:
_OBJC_METACLASS_$_MainViewController in MainViewController.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is this related to what your talking about above? Been running circles for a while re this.
I haven’t seen that specific one, but I’d rerun the update script above, then do a clean/build in xCode.
I don’t really sure this will help but, NLeggatt, that error you got just came from you choose architecture as armv7s. I am too, also need to use architecture as arm7 for my app which need to run in iPad3 and this update script doesn’t help compile with that architecture.
I tried to reduce architecture to armv6 and it did build successfully. So I want to share this if your project doesn’t fix to use armv7s, reduce architecture in “Build Settings” to armv6 will help.
You spell Xcode like Xcode not “xCode”!
Is it possible to use phonegap 2.2.0 with Xcode 4.2.1? I had follow the instruction from phone gap site, but xcode prompt me many error message such like “No known class method found for selector “createBackupInfoWithCloudBackup”. Beside that, libCordova.a shown in red font in the “Link Binary With Libraries”. I had change all the architecture to armv7. Can you help to advice?
Hmm any reason why you can’t upgrade to the latest Xcode?
If I try to run your XCode project pulled from github I get errors like:
CORDOVA/CDVPlugin.h file not found, Cordova/CDVViewController.h file not found and so on
then I typed following in the terminal I started in the Cordova/bin folder:
./update_cordova_subproject /Users/###MYUSERNAME###/NativeControls/Cordova.xcodeproj
this is what I got: Sub-project entry not found in project file
and the upper problem still exists
Hi,
for working on jquery mobile wth xcode do we need to implement this
You need PhoneGap to bridge the gap between web code and Native apps. It is basically just a web browser wrapper.
On XCode 4.6 Target and Project should have the same deployment target version in order for the ./update to work.