As you may already know PhoneGap/Cordova 2.x has changed how the framework is referenced in iOS projects. This new approach gives more flexibility and ease of installation but at the same time it has some quirks especially when working in Xcode on multiple projects at the same time. This may actually change in the future releases as you may see there is an active discussion about it on the callback-dev mailing list.
In the meantime I wanted to share how you can quickly change a reference to CordovaLib directly from Xcode. The approach I prefer is to embed CordovaLib under my project directory. This way I can push it to my repository and version control it with my project files.
- Copy CordovaLib from/lib/ios/CordovaLib (if you are cloning it from GitHub, CordovaLib can be found directly under root folder) to your Xcode project directory. In my case I copied it into the MyProject subdirectory that is at the same level as MyProject.xcodeproj file. You may also choose a parent directory of MyProject or of course anywhere else you want to have it hosted.
- Open your project in Xcode and remove the reference to CordovaLib using the delete button or cmd+backspace.
- Right-click on the project root element, select “Add Files to YourProject”… option and choose CordovaLib.xcodeproj file that is under CordovaLib directory you copied in step 1.
- Select the MyProject > TARGETS > MyProject > Build Phases tab and add CordovaLib under the Target Dependencies panel.
- In the same Build Phases tab expand “Link Binary With Libraries” and add libCordova.a into the list.
Once you are done with the above steps you should be able to rebuild and run your project with embedded CordovaLib.