Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

iOS app still load index.html from old externalStorage after I update the app #99

Closed
sckoh opened this issue Feb 4, 2016 · 11 comments
Closed

Comments

@sckoh
Copy link

sckoh commented Feb 4, 2016

  1. I first install the iOS app
  2. www is copied to externalStorage
  3. i install and replace the iOS app
  4. the app still load index.html from externalStorage

It should load the index.html from www after I update the iOS app right?

@nikDemyankov
Copy link
Member

Please, read https://github.com/nordnet/cordova-hot-code-push#how-web-project-files-are-stored-and-updated. That part of the docs explains, why this is happening. In short: when the app starts - plugin checks, if www folder installed on the external storage. If it is - it loads index.html from it. Packed version of index.html is used only when versionCode of the app has changed, or application is installed for the very first time.

So, if you just update the app - packed version is ignored. To simplify the development you can use local dev add-on.

@sckoh
Copy link
Author

sckoh commented Feb 5, 2016

I have changed the build version in xcode and the release value in chcp.json.

@nikDemyankov
Copy link
Member

This is how I tested it.

  1. Create an empty application and add plugin to it:

    cordova create Test
    cd ./Test
    cordova platform add ios
    cordova plugin add cordova-hot-code-push-plugin
    
  2. In the config.xml set plugin preferences:

    <chcp>
        <config-file url="https://someserver.com/chcp.json" />
    </chcp>
  3. Launched the app:

    cordova run ios
    
  4. Updated Test/www/index.html, updated chcp.json with new release and relaunched the app with cordova run ios. As a result - plugin loads index.html from the local storage, but then detects, that something new is available and installs that new version of index.html from the server.

  5. In the config.xml I changed ios-CFBundleVersion of the app:

    <widget id="io.cordova.hellocordova" 
        ios-CFBundleVersion="12" 
        version="0.0.1" 
        xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    
  6. Launched the app again with cordova run ios. As a result - plugin loaded index.html from the bundled assets instead of external storage.

@sckoh
Copy link
Author

sckoh commented Feb 5, 2016

I need to change the ios-CFBundleVersion?
I don't have ios-CFBundleVersion in my config.xml. I just change the
version property in config.xml

On Fri, 5 Feb 2016, 23:54 Nikolay Demyankov [email protected]
wrote:

This is how I tested it.

Create an empty application and add plugin to it:

cordova create Test
cd ./Test
cordova platform add ios
cordova plugin add cordova-hot-code-push-plugin

In the config.xml set plugin preferences:

Launched the app:

cordova run ios

Updated Test/www/index.html, updated chcp.json with new release and
relaunched the app with cordova run ios. As a result - plugin loads
index.html from the local storage, but then detects, that something
new is available and installs that new version of index.html from the
server.
5.

In the config.xml I changed ios-CFBundleVersion of the app:

Launched the app again with cordova run ios. As a result - plugin
loaded index.html from the bundled assets instead of external storage.


Reply to this email directly or view it on GitHub
#99 (comment)
.

@nikDemyankov
Copy link
Member

version property defines version of the app, that is visible to the user. ios-CFBundleVersion defines the code version of the app, or a build version. When application is uploaded to the App Store - build version should be increased. Plugin uses it as a trigger to understand, if application was updated via store. And if it was - it will reinstall www folder from the bundle onto external storage. Otherwise - it will use cached external version.

@pablomaurer
Copy link
Contributor

mhm i deployed the app with initially with

  • version: 1.0.0
  • build: 1.0.0
  • cordova-chp build
  • ionic build
  • xcode run

then i made a change and tried to deploy the following ways

  • change build to 1.0.1 -> deployed -> no change happened
  • change also version to 1.0.1 -> deployed -> no change happened
  • run also cordova-hcp build -> deployed -> no change happened

Finally found out it only works with Integers? Is this wanted or a bug?

@nikDemyankov nikDemyankov added this to the v1.4.0 milestone May 27, 2016
@nikDemyankov
Copy link
Member

@mnewmedia Good catch. You can say, that it's a legacy stuff. Previously it was using it as an integer, because the same value was used for min_native_interface preference. And it had to be an integer. Now it's a separate preference, so I can switch it to string. Will fix that.

@nikDemyankov
Copy link
Member

@mnewmedia uploaded fix in the repo: build version can now be a string. So, changing it from 1.0.0 to 1.0.1 will trigger reinstallation of www folder.

@nikDemyankov
Copy link
Member

Released.

@barocsi
Copy link

barocsi commented Aug 6, 2016

I this fixed in the wkwebview branch as well?

@nikDemyankov
Copy link
Member

@barocsi Don't actually remember. I'd suggest to use npm version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants