How can I transfer a Cordova iOS app from one PC to other? The app is made in some other version of Cordova and I want to upgrade its Cordova version.
问题:
回答1:
You can follow the steps below:
- In new PC, install the latest version of cordova using
npm install -g cordova
command - In new PC, create a new cordova project using
cordova create PROJECT_NAME command
in desired location using terminal - Now navigate to the newly create project folder, copy the contents of
WWW
folder andconfig.xml
file from Old project in Old PC and replace the same in newly created project folder. - In terminal, navigate to project root directory and install the
required plugins in new project using
cordova plugin add PLUGIN_NAME
command - After installing required plugins, add the iOS platform to the
project using
cordova platform add ios
command - Now build the project using
cordova build ios
command
You are good to go now. But you gotta test your project once thoroughly as some plugin may not works as expected with latest cordova version.
回答2:
With the newer versions of Cordova this process has been made much easier. The config.xml
can now hold entries which specify the plugins and platforms your app will run. Look at this example. You can add these entries to your config.xml
:
<engine name="android" spec="~5.1.1" />
<engine name="ios" spec="~4.1.0" />
<engine name="browser" spec="~4.0.0" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<plugin name="cordova-plugin-console" spec="~1.1.7" />
<plugin name="cordova-plugin-dialogs" spec="~1.2.0" />
When you run cordova platform prepare ios
, if not already created, Cordova will fetch the missing platforms and plugins for you. This a good way to start building your app if not already started.
回答3:
you can copy project folder one to another. if you have different version you can upgrade. if you have upgraded cordova. type in terminal project's folder cordova platform update ios and cordova platform update android if you dont before this : sudo npm update -g cordova