Add Cordova to an existing Xcode project in iOS
The Cordova official website has detailed the steps for creating a PhoneGao project. I will not go into details here.
In actual project development, you may need to add Cordova to an existing project. This problem has recently been encountered. Although there are some tutorials on the internet,
But it is no longer applicable to the latest version of Cordova.
1. Add a Demo project with the following directory structure:
2. Copy the Cordova files to the Demo directory. The directory structure is as follows:
3. Add CordovaLib. xcodeproj To the Demo project, right-click and choose Add Files To Demo.
4. Add the www directory to the project. Check "Create folder references ".
5. Add config. xml to the project in step 3. The directory structure is as follows:
6. Select Build Settings> Other Links of the project and set-Objc-all_load.
7. Select Build Phases-> New Run Script Phase and name the New Run Script Phase as copy www directory.
8. Build Phases-> Target Dependencies add CordovaLib
9. Link Binary With Librarys add libCordova. a, MobileCoreServices, AssetsLibrary
9. Now you can use Cordova normally. Note that other linkers must be set,
'-[_ NSCFConstantString JSONObject]: unrecognized selector sent to instance; otherwise, a similar error is prompted.