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

iOS CodePush.m `getStartPageURLForLocalPackage` return 0 when URL with parameterString

Open kntmrkm opened this issue 5 years ago • 11 comments

Additional Information

  • cordova-plugin-code-push version: 1.11.18
  • Cordova version: 7.0.1

Description

I'm using CodePush plugin with ionic framework (cordova 7.0.1).

My cordova's config.xml has a below URL. It's with parameterString.

index.html?deviceType=ios

So, getStartPageURLForLocalPackage (https://github.com/microsoft/cordova-plugin-code-push/blob/af67ac16f15cfacd1bd216480e56f221d1396d9c/src/ios/CodePush.m#L268) will return 0 always.

Debug info

realStartPageLocation value is /Users/kntmrkm/Library/Developer/CoreSimulator/Devices/3A19F158-A4F6-4DBA-A45C-417D30E8A35A/data/Containers/Data/Application/B280835C-2ED9-4D31-9C63-B0BF4B67F64E/Library/NoCloud/codepush/deploy/versions/5355be3536f8cc924d3d891095b4848a7c5f9fe7e891e868b0f60eb7f056256a/www/index.html?deviceType=ios

When replaced ?deviceType=ios to "".

realStartPageLocation = [realStartPageLocation stringByReplacingOccurrencesOfString:@"?deviceType=ios" withString:@""];

getStartPageURLForLocalPackage will return 1 (expected).

thanks

kntmrkm avatar May 25 '19 03:05 kntmrkm

Hi @kntmrkm, Thanks for reporting and detailed info!

It is strange. Could you please provide some dummy project with reproducing issue and reprosteps? I would like to debug it.

alexandergoncharov-zz avatar May 27 '19 10:05 alexandergoncharov-zz

@alexandergoncharov Thanks for replay.

This is my temporary repo... https://github.com/kntmrkm/ionic-codepush

  • Install ionic npm -g i ionic
  • Install cordova npm -g i cordova
  • Add platform ionic platform add ios
  • Build iOS ionic cordova build ios
  • Open platforms/ios/MyApp.xcworkspace
  • Run with any simulator

You will get bellow error.

2019-05-27 22:04:09.517283+0900 MyApp[77631:1337346] ERROR: [CodePush] An error occurred during sync. An error has occured while installing the package. Could not find start page in package.. StackTrace: preInstallFailure@ionic://localhost/plugins/cordova-plugin-code-push/bin/www/localPackage.js:246:50
callbackFromNative@ionic://localhost/cordova.js:290:57
ionic://localhost/plugins/cordova-plugin-ionic-webview/src/www/ios/ios-wkwebview-exec.js:129:35
run@ionic://localhost/polyfills.js:2512:49
ionic://localhost/polyfills.js:3251:37
runTask@ionic://localhost/polyfills.js:2557:57
drainMicroTaskQueue@ionic://localhost/polyfills.js:2963:42
promiseReactionJob@[native code]

よろしく!

kntmrkm avatar May 27 '19 13:05 kntmrkm

Thanks for the repo! I reproduced your issue but I'm confused about using parameter as part of the file path in particular 'deviceType'. Could you please clarify why you are using this parameter?

alexandergoncharov-zz avatar May 28 '19 11:05 alexandergoncharov-zz

I'm joined one team recently. I don't know why that detail without asking my senior.

There are several reasons I think maybe.

  • Useful custom dev env.
  • Use deviceType info in out of Angular(Ionic framework).
  • Constraint of using specific plugin.

Anyway, param is required our project.

kntmrkm avatar May 28 '19 12:05 kntmrkm

Hi @kntmrkm Sorry for delay!

Here is fix for your issue: https://github.com/microsoft/cordova-plugin-code-push/compare/Goncharov/Fix_start_page_url_query Could you please test it?

However this issue is pretty rare so I'm afraid releasing this fix would be prematurely. But of course If community will need this it would be released =)

FYI: сordova plugin could be installed from github repo, for this case you could use this command: cordova plugin add https://github.com/microsoft/cordova-plugin-code-push#Goncharov/Fix_start_page_url_query

Sorry for the inconvenience.

alexandergoncharov-zz avatar Jun 13 '19 14:06 alexandergoncharov-zz

Thanks I'll try later!

kntmrkm avatar Jun 14 '19 00:06 kntmrkm

Great! We will be waiting for your results.

alexandergoncharov-zz avatar Jun 14 '19 10:06 alexandergoncharov-zz

[CodePush] Package download success:

It works!

This fix will not release? Please release to avoid happens same issue to someone. and for us.

Please consider it. thanks again.

kntmrkm avatar Jun 14 '19 13:06 kntmrkm

Won't merge? We are expecting merge....

kntmrkm avatar Jun 24 '19 06:06 kntmrkm

I am also expecting this to be merged. Is there some reason it can't be?

The issue appears to occur in iOS projects using WKWebView (which is now mandatory, according to Apple). So any Cordova iOS developer will NOT BE ABLE TO USE THIS PLUGIN.

Quite a serious issue for any iOS Cordova developer, and I am not aware of any other reliable code push alternative.

Pigsnuck avatar May 18 '20 12:05 Pigsnuck

@alexandergoncharov this is also a pretty big issue on our end. We use https://www.npmjs.com/package/cocoon-cordova-labs-local-webserver which requires http://localhost as the content src and breaks codepush sync.

schingeck avatar Aug 17 '20 13:08 schingeck