Install the plugin first, the steps are as follows
1. Run Cordova plugin add Cordova-hot-code-push-plugin in the app directory
2. Run Cordova plugin add Cordova-hot-code-push-local-dev-addon in the app directory
3, installation CLI:NPM install-g CORDOVA-HOT-CODE-PUSH-CLI
In this step, if there is an installation error, the following methods can be resolved:
A, install python2.7, and add C:\Python27 to environment variable
B, installation Vs2013_rtm_dskexp_chs
Start Configuration
4. After the installation is complete, run CORDOVA-HCP build, then Chcp.json and chcp.manifest two files appear under WWW folder
A, Chcp.json file content description
{
"Autogenerated": true,
"Release": "2016.08.29-15.52.14",//version number
"Content_url": "http://www.123.com/www/", the remote address where the//www folder resides
"Update": "Now"//divided into three kinds of situations
Start-app Install the update at startup. The default value.
Resume-app Install updates when switching from the background.
Now-web content is downloaded to install the update.
}
The file is automatically regenerated each time the CORDOVA-HCP build is run, so you can add a template file Cordova-hcp.json to the root of the app project, as follows:
{
"Autogenerated": true,
"Release": "2016.08.29-16.52.27",
"Content_url": "http://www.123.com/www/",
"Update": "Start"
}
B, chcp.manifest as a list of documents
5. In the root directory of the app project, a. chcpenv file is generated, open the file, edit the remote address for the update, and the remote profile address as follows:
{
"Content_url": "http://www.123.com/www/",
"Config_url": "Http://www.123.com/www/chcp.json"
}
Test Run
6. Pack and run the app, such as Ionic run Android
7. Change the content of the page in an app, then run CORDOVA-HCP build to generate the latest configuration. Then copy all files (including Chcp.json and chcp.manifest two files) from the entire WWW directory to a remote address configured in Chcp.json. In this case, the directory is copied to the remote IIS www
8, re-open the app (remember to open two times to see the effect), see just the update effect it.
Configuration under iOS
The configuration of iOS may vary depending on the plug-in version. The following is an example of version 1.4:
1, compile the time will be reported ' _-swift.h ' File not found error, open HCPLDPlugin.h files, the head #import "_-swift.h" changed to
#import "Baccarat Cloud Mall-swift.h"//Here "Baccarat Cloud Mall" is the name of your app, for example:
#ifdef __objc__
#import "testproject-swift.h"
#endif
2, compile when the unknown type name ' socketioclient ' error, you need to confirm #import "Baccarat Cloud Mall-swift.h" This line is in the HCPLDPlugin.h file header
3, add in the Info.plist
<key>NSMainNibFile~ipad</key>
<string></string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
4. Embedded content contains swift code set to Yes
5. Embed Asset Packs in Product bundle set to Yes
Otherwise, when the app is running on the real machine, it will flash back, while the simulator
Libc++abi.dylib:terminating with uncaught exception of type nsexception*
The error
Flash Back Solution 2:
Under Xcode--"window--" project--"your project name-->delete derived data