cordova-plugin-code-push icon indicating copy to clipboard operation
cordova-plugin-code-push copied to clipboard

My ios app download last package and not install it

Open alpaygunes opened this issue 7 years ago • 48 comments

Description (sory for my english) I'am using CodePush plugin. My ios app download last package but not install it.

Then when I close the application and open it again, I cannot see the update. The process of updating codepush is being repeated

Reproduction

1 - install cordova-plugin-code-push 2 - build ipa and apk files 3 - install ipa file on test device 4 - change app source code 5 - prepare for ios and release on codepush server 6 - ios app not update.

Additional Information plugin name="cordova-plugin-whitelist" spec="1.3.3" plugin name="cordova-plugin-statusbar" spec="2.4.2" plugin name="cordova-plugin-device" spec="2.0.2" plugin name="cordova-plugin-splashscreen" spec="5.0.2" plugin name="cordova-plugin-ionic-webview" spec="^2.0.0" plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" plugin name="cordova-plugin-x-socialsharing" spec="5.4.1" plugin name="onesignal-cordova-plugin" spec="2.4.5" plugin name="cordova-plugin-code-push" spec="1.11.17" plugin name="cordova-plugin-file-transfer" spec="^1.7.1" plugin name="cordova-plugin-file" spec="6.0.1" engine name="android" spec="7.1.2" engine name="ios" spec="4.5.5"

alpaygunes avatar Jan 23 '19 20:01 alpaygunes

same here with ionic 4.

gulullu avatar Jan 25 '19 02:01 gulullu

Hi @alpaygunes, @gulullu Thanks for reporting!

Could you please provide logs during update? You can grab it with XCode.

alexandergoncharov-zz avatar Jan 25 '19 12:01 alexandergoncharov-zz

Hi @alpaygunes, @gulullu Thanks for reporting!

Could you please provide logs during update? You can grab it with XCode.

Hi, I checked it and the logs looks like ok, but when I closed the app and reopen it, it become to the first native version.

gulullu avatar Jan 28 '19 02:01 gulullu

@gulullu , Could you please provide some dummy project with reproducing issue and reporosteps? I would like to reproduce it and debug.

alexandergoncharov-zz avatar Jan 28 '19 05:01 alexandergoncharov-zz

@alexandergoncharov

Hi, Here is my demo project: https://github.com/gulullu/MyApp.git.

And my environment info:

Ionic:

   ionic (Ionic CLI)             : 4.6.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0
   @angular-devkit/build-angular : 0.12.3
   @angular-devkit/schematics    : 7.2.3
   @angular/cli                  : 7.2.3
   @ionic/angular-toolkit        : 1.2.3

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.2, (and 10 other plugins)

System:

   Android SDK Tools : 26.0.1 (/usr/local/opt/android-sdk)
   ios-deploy        : 1.9.4
   ios-sim           : 5.0.11
   NodeJS            : v11.4.0 (/usr/local/Cellar/node/11.4.0/bin/node)
   npm               : 6.4.1
   OS                : macOS Mojave
   Xcode             : Xcode 10.1 Build version 10B61
  • Step 1 replace with your deploymentKey in 'tab1.page.ts'
  • Step 2 ionic cordova build ios --prod --release
  • Step 3 open MyApp.xcworkspace and run app on simulator or devices
  • Step 4 change 'Update Label: 1' to 'Update Label: 2' in tab1.page.html with text editor
  • Step 5 ionic cordova build ios --prod --release
  • Step 6 code-push release-cordova MyApp-ios ios --targetBinaryVersion 0.0.1
  • Step 7 check update and install it, the running app's text 'Update Label: 1' change to 'Update Label: 2'
  • Step 8 kill the running app and reopen it, the label become to 'Update Label: 1'

also a gif:

demo

gulullu avatar Jan 28 '19 06:01 gulullu

I have the same problem and I downgraded to 1.1.15 and it works fine there seems the issue is here:

https://github.com/Microsoft/cordova-plugin-code-push/blob/4b533149a85539666f937b2b4e8dd2fc8153f1ab/src/ios/CDVWKWebViewEngine%2BCodePush.m#L18

the application downloads the zip file ..extract it .. set the root path for the ionic but finally the above line and revert the root path to old path! this is hapening when using "cordova-plugin-ionic-webview" this problem caused .. when using 'cordova-plugin-wkwebview-engine' it is fine!

zanganeh avatar Jan 30 '19 06:01 zanganeh

having the same issue. We are also using cordova-plugin-ionic-webview. Can confirm that downgrading to 1.11.15 fixes the issue. Haven't tried swapping to cordova-plugin-wkwebview-engine as we rely on functionality from the ionic one

microadam avatar Jan 30 '19 16:01 microadam

Hey @alexandergoncharov

Any update on this?

zanganeh avatar Feb 01 '19 21:02 zanganeh

Hi @zanganeh , Sorry for delay.

Yeah, I reproduced your issue. Sorry for this. Investigating how to fix it.

alexandergoncharov-zz avatar Feb 05 '19 10:02 alexandergoncharov-zz

Appreciate it @alexandergoncharov

zanganeh avatar Feb 05 '19 20:02 zanganeh

Any update on this?

TylerAHolden avatar Feb 15 '19 17:02 TylerAHolden

Any update ?

zanganeh avatar Feb 19 '19 12:02 zanganeh

Hi @zanganeh @NG-tylerholden ,

Sorry for this delay. I also involved in another repo and my investigation is still in progress. We should make fix which should be worked for Ionic4, ionic3, clear Cordova and Cordova with WKWebView plugin. This require more time unfortunately. I will keep you in touch about progress.

alexandergoncharov-zz avatar Feb 19 '19 12:02 alexandergoncharov-zz

I'd like to join the party :) I has been investigating this issue for quite a some time now.. after several hours I've noticed, that after app restart CodePush has issues of notifying that the app has deployed well. I see this line in console after restarting updated app:

XMLHttpRequest cannot load https://codepush.azurewebsites.net/reportStatus/deploy due to access control checks.

Here is my meta tag with Content Security Policy:

<meta http-equiv="Content-Security-Policy"
          content="default-src 'self' *.azurewebsites.net
          data: https://ssl.gstatic.com 'unsafe-inline' 'unsafe-eval';
          style-src 'self' 'unsafe-inline' http://fonts.googleapis.com ;
          script-src * 'unsafe-inline' 'unsafe-eval';
          font-src http://fonts.gstatic.com;
          connect-src *;
          media-src *;
          img-src 'self'
          content:;"/>

Here's the syncing code:

window.codePush.sync((status) => {
      console.log(status);
    }, { 
      installMode: InstallMode.ON_NEXT_RESUME,
      minimumBackgroundDuration: 0,
      mandatoryInstallMode: InstallMode.IMMEDIATE })

Cordova plugins that we are using:

code-push 2.0.6 "CodePushAcquisition"
cordova-android-support-gradle-release 1.4.7 "cordova-android-support-gradle-release"
cordova-plugin-code-push 1.11.17 "CodePush"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-customurlscheme 4.3.0 "Custom URL scheme"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-inappbrowser 2.0.2 "InAppBrowser"
cordova-plugin-ionic-webview 4.0.0 "cordova-plugin-ionic-webview"
cordova-plugin-safariviewcontroller 1.5.4 "SafariViewController"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-zip 3.1.0 "cordova-plugin-zip"
sentry-cordova 0.13.1 "Sentry"

We'd love to use cordova plugin ionic webview of current version (e.g. not downgrading to 1.1.15, or going with cordova plugin bcs of project settings and historical problems and long term sustainability).

The behaviour currently looks like this. I build the app as mentioned in previous comments, but I have InstallMode.ON_NEXT_RESUME so once the app updates and installs, I put it in background.. then by putting on foreground I can see the new version is installed and served.

Once I kill the app and restart it, I get the XMLHttpRequest cannot load https://codepush.azurewebsites.net/reportStatus/deploy due to access control checks. console log which I think is the reason of rolling back to "bundled" code.

Speaking of bundled code.. I've also found out using iOS simulator, that the bundled code (that is distributed in AppStore) is physically still in www folder of installed application. Is this wanted behaviour? So CodePush stores all fetched versions into codepush directory and the original www/index.html of app is never replaced?

I am really willing to provide more info as I'd like to progress on this one and have it out of table.

Thanks for any kind of help and looking forward to updates 👍

marecektn avatar Feb 22 '19 11:02 marecektn

Is any update about fix on the horizon? 🤸‍♂️

marecektn avatar Feb 26 '19 16:02 marecektn

Any update on this @alexandergoncharov

zanganeh avatar Mar 05 '19 10:03 zanganeh

Hi all,

I'm so sorry for this delay but my investigation is still in progress. Looking for real reason of issue as it isn't rollback. Looks like there is some issue with setting new update for app. I'll be keep you posted.

alexandergoncharov-zz avatar Mar 05 '19 12:03 alexandergoncharov-zz

Any update ?

davidellolio avatar Mar 06 '19 17:03 davidellolio

I'm looking forward !

alpaygunes avatar Mar 06 '19 19:03 alpaygunes

[CodePush] An error occurred during sync. Deployment key not found Why is the key wrong for ios hot update?

15019493655 avatar Mar 07 '19 02:03 15019493655