Open mOOnIrsama opened 4 years ago
This also happens on Android, is there any fix for this. Working environment is exactly the same as with @mOOnIrsama
I'm having this issue on iOS only. I'm using cordova-ios 6.10 (with the code from PR https://github.com/microsoft/cordova-plugin-code-push/pull/513 for compatibility). I'm also using WKWebView, and the error occurs both on the simulator and on test devices.
I suspect this is related to WKWebView and this code: https://github.com/microsoft/cordova-plugin-code-push/blob/master/src/ios/CodePush.m#L409
@amjadyahya1 what is your stack trace on Android? I'm guessing it's a different issue.
UIKit
unsafe thread warning is unlikely to affect the success of CodePush installation. It does not halt code execution. Thread safety violations which would affect your app are implemented by Apple to immediately crash it.
@ermik Thanks for the insight. I took a look at the JS console from Safari, connected to the simulator, and this is what I see. Maybe this will shed some more light on what's actually causing the issue.
app://localhost/Users/<username>/Library/Developer/CoreSimulator/Devices/<id>/data/Containers/Data/Application/<id>/Library/NoCloud/codepush/deploy/versions/<id>/www/index.html
Failed to load resource: the server responded with a status of 404 ()
Seems like it's still trying to load the new version from the file system url.
Still happens with v1.13.0, see #624
This project and issue are critical to my team, so I'm spending some time debugging even though I'm not very experienced with native iOS development or Objective-C. I'm chronicling my findings here in semi-real time in he hope that someone will have a helpful insight to speed this process along. So here goes:
loadPackage()
in CodePush.m calls getStartPageURLForLocalPackage
() which takes the url and adds 'file://' to the beginning (which doesn't work in WKWebView which doesn't use file:// urls). This is passed to loadUrl()
which runs [self.webViewEngine loadRequest:[NSURLRequest requestWithURL:url]];
.
There's also a file named 'CDVWKWebViewEngine+CodePush.m' and I'm not sure what it does. My guess is that it's supposed to extend the 'CDVWKWebViewEngine' class from the wkwebview-engine plugin that was used before cordova-ios v6. Now that plugin is no longer used - see https://cordova.apache.org/howto/2020/07/18/uiwebview-warning.html:
The official Apache WKWebView plugin is no longer needed with these cordova-ios versions since WKWebView has been integrated and UIWebView is removed.
So it seems like CDVWKWebViewEngine+CodePush.m just isn't loaded becuase of #if __has_include("CDVWKWebViewEngine.h")
and therefore there's nothing to catch file:// urls and convert them to the app://localhost scheme that WKWebView needs.
@szh This plugin is critical to my project too. I'm using with cordova-ios@6.1.0
without issues. I define the Keys via TypeScript side (not config.xml). And I don't use <preference name="WKWebViewOnly" value="true" />
and have no warnings when submitting do Itunes Connect.
Create a simple test project just to see if the problem happens. It could be something in your project.
@ludufre Do you also use cordova-plugin-wkwebview-engine?
Continuing my debugging... Using my previous findings, I moved some code from 'CDVWKWebViewEngine+CodePush.m' to 'CodePush.m' and that fixed the issue immediately after install. Here's my commit: https://github.com/szh/cordova-plugin-code-push/commit/41e1a79c3b58f39388b672e480aa06adf874de19
However after closing the app and reopening it doesn't load. I assume it's still trying to load from a file:// url but I'm not sure where that code is.
@szh No. I use cordova-plugin-ionic-webview
because Ionic. If you are using cordova-ios@6
you don't need this plugin anymore. See: https://cordova.apache.org/announcements/2020/06/01/cordova-ios-release-6.0.0.html
@ludufre Right, I'm not (look again at my earlier comment), just checking whether you were. There is code in this plugin to deal with ionic's webview differently which may be why you're not having this issue.
@szh So everything is now working in your new PR?
@szh So everything is now working in your new PR?
Yes
Any chance of getting this reviewed/merged in?
Any chance of getting this reviewed/merged in?
Need this updated version to, thank you,
Hi all, Thanks for reporting and sorry for the delay!
Unfortunately, I can't reproduce this compatibility issue. Could you please provide some demo app with reproducing issue and reprosteps? I used the latest versions of Cordova and cordova-ios in my test app.
@szh No. I use
cordova-plugin-ionic-webview
because Ionic. If you are usingcordova-ios@6
you don't need this plugin anymore. See: https://cordova.apache.org/announcements/2020/06/01/cordova-ios-release-6.0.0.html
this is the right solution! thank you
Hi there! We opened PR for fixing the issue with CDVUserAgentUtil: #642 Take a look if you have time. @szh, Could you please let me know if it was helpful for you?
Hi all,
We merged this PR https://github.com/microsoft/cordova-plugin-code-push/pull/642 and published new 1.13.1
version. Could you please test it and let us know if it fixed your issue?
Hi all, We merged this PR #642 and published new
1.13.1
version. Could you please test it and let us know if it fixed your issue?
not working
The following build commands failed: CompileC /Users/user/Library/Developer/Xcode/DerivedData/Sendify_Conductor-acautfakroysqpdhgitjezmjczop/Build/Intermediates.noindex/Sendify\ Conductor.build/Debug-iphonesimulator/Sendify\ Conductor.build/Objects-normal/x86_64/CDVWKWebViewEngine+CodePush.o /Users/user/Downloads/ionic5/sendifydelivery/platforms/ios/Sendify\ Conductor/Plugins/cordova-plugin-code-push/CDVWKWebViewEngine+CodePush.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure) xcodebuild: Command failed with exit code 65
Ionic:
Ionic CLI : 6.10.1 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 5.2.1 @angular-devkit/build-angular : 0.803.27 @angular-devkit/schematics : 8.3.27 @angular/cli : 8.3.27 @ionic/angular-toolkit : 2.2.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1) Cordova Platforms : android 9.0.0, ios 6.1.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 25 other plugins)
Hi all,
If you still have issues could you please provide some demo app with reproducing issue and reprosteps? Unfortunately, we can't reproduce any issues with it.
Has anyone found the solution? Still happening in latest version: 2.0.0
@adancarrasco , I think you should make some demo repo...
Has anybody found the solution to this? I'm on the latest version (2.0.0) and I have no clue, where to start debugging.
Cordova CLI : 10.0.0
Cordova Platforms : android 9.0.0, ios 6.1.1
@ankitjainOfficial do you have a demo app? It works fine for me..
@sithwarrior Unfortunately, don't have a demo handy. Is there any hint, where I can start my debugging?
@ankitjainOfficial What you need? I also face the bug in cordova project.
In my project Vue create demo cd demo/src-cordova cordova platform add ios cordova plugin add cordova-plugin-code-push@latest
...config code push and testing
finally, you'll find the bug
does anyone have a solution?
@veneliniliev Rolling back to 1.8 solved for me. with v2, no solution worked for me.
i found a solution in my case.
when i use cordova-plugin-ionic-webview and set \
when remove preference, everything works fine!
in iOS Simulator the app is updated and after its auto restarted, all of the cordova plugins no longer works and whenever I relaunch the apps rollbacked to previous version. Below is the logs and my project details
Project: plain cordova code-push: 1.12.2 iOS: 13.4.1 WebVIew: WKWebView
Javascript:
Config:
<preference name="WKWebViewOnly" value="true" />
Logs: