-
Notifications
You must be signed in to change notification settings - Fork 358
Blank screen after using plugin-wkwebview-engine #143
Comments
Can you confirm that the config has been added to your <feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" /> https://github.com/apache/cordova-plugin-wkwebview-engine#configxml |
I have updated my original comment with images of relevant config sections. As you can see I have included the config. |
I had the same kinda issue and had to add https://github.com/apache/cordova-plugins/blob/wkwebview-engine-localhost/README.md and the other requirements detailed on the git readme to work. |
Hmm, do you know what your config.xml looks like now, specifically the plugin tags? I am having issues using cordova plugin add since this project has a complicated build chain using a Grunt file. To test this I was hoping to just add the localhost plugin you referenced into my config.xml and then run my grunt task. |
I have removed all my plugins and test my app without this plugin, everything works fine on cordova-ios 5.0.0. I can confirm that this plugin is causing the white screen issue. |
Are there any reported javascript errors in the safari web inspector? Do note that you'll need to refresh the webview once the inspector is opened to see any startup errors because I don't think safari shows any logging before the inspector is connected. You should able to do this by pressing cmd+r in while the web inspector is focused. I would think javascript errors to show in the xcode log, but someone I think on slack was having problems with this, so best to double check safari web inspector to be sure. |
With Normally, you have to modify your webserver to add the appropriate CORS headers, but since you're using XHR requests on local files, there is obviously no webserver at play here, so adding those appropriate headers becomes difficult. The solution is to either use cordova-plugin-file to load those files using the filesystem APIs instead OR Use the third-party cordova-plugin-wkwebview-file-xhr plugin which intercepts the XHR requests and excluding the For your case, since it looks like angular is the one making those requests, you're probably best off on using the wkwebview-file-xhr plugin. Be sure to read their known issues to determine if you'll be affected by it. Let me know if this helps. |
I had the same problem with my Angular8+ app. I ended up using hash routing for mobile devices: and the following line in index.html |
This app was written in AngularJS. Below is the code that is being used to load the views. Any suggestions how I would implement either @breautek or @elmartino solutions with this code? From the examples that I have seen I was not able to see how these solutions could be applied. May just be me not knowing the details of this area. I appreciate the support, thank you very much.
|
I'm not overly familiar with angular (i used angular a very long time ago...) but based on the callstack, it looks like angular is the one that is making the XHR request. This is why I said installing the https://github.com/oracle/cordova-plugin-wkwebview-file-xhr will likely be the easiest solution. I don't think you need to do any code changes. This works because the plugin overrides the implementation of |
I'm only familiar with Angular2+ but i think you could try only the 2nd part of my solution. |
@breautek so you think that just by installing that plugin it could solve the problem? |
Update: Still getting the same error. |
Try: |
Is there any possibility that cordova-plugin-wkwebview-engine-localhost could work? As @BradCB mentioned it solved his problem. I have however tried replacing cordova-plugin-wkwebview-engine with cordova-plugin-wkwebview-engine-localhost and I get dependency errors with my version of cordova-file-plugin. It says I need to use ^5.0.0 but when I use that it still gives the same error. |
@BraydenGirard I think you need cordova-plugin-wkwebview-engine plugin AND |
You should remove the other base element
Verstuurd vanaf mijn iPhone
… Op 22 apr. 2020 om 17:33 heeft Brayden Girard ***@***.***> het volgende geschreven:
Like this I'm assuming? Still didn't fix the white screen :(
Thank you for all the help!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@BradCB ok, I will try that. @elmartino Which base element are you suggesting I remove? The one in my screenshot looks like it is being inserted dynamically. Would that not be what the script tag you suggested I add do? The screenshot is after the page has been loaded in the browser. If I look at the html file in my editor that base element does not exist. |
It works on iOS 12.0/12.1 but not 12.2, does anybody has solution for that? |
Yeah, when I add both I get a dependency error with corodova-file-plugin saying it needs to be version 5.0.0 even though I have that version... |
@elmartino: do you use the ChangeDetectionStrategy.OnPush in your project? After adding cordova-plugin-wkwebview-file-xhr the view does not refresh but data are loaded correctly from api. |
I just use default ChangeDetectionStrategy. I didn't used any other cordova wkwebview plugins than the cordova-plugin-wkwebview-engine I just added the useHash part in my case only if environment === mobile (i have seperate environment files) and the line |
@elmartino: do you use web api requests in your project? Without |
Yes i do, but you have to fix them on server side not in client side. You should make sure your server accepts CORS requests (or use a proxy) |
My server accept CORS, the configuration is as follow c#:
What I'm missing? |
Maybe access-control-allow-methods? Maybe test it using https://www.test-cors.org/ |
@elmartino: the |
I had an Angular app integrated with Cordova and had trouble getting the app to load using Cordova's WebView Plugin. Since none of the solutions worked for me, I ended up using Ionic's WKWebView plugin (https://github.com/ionic-team/cordova-plugin-ionic-webview). These are the steps I followed:
I even uploaded the app to TestFlight and Apple did not complain of UIWebView, which sort of validates the fix. |
@srinidhirao: do you know whether |
@kzimny I don't know specifically. But a quick search on their GitHub page lists various issues with the Cookies. Some even claiming that WKWebView itself has issues with cookies: One such post: |
This solution worked for me. The only issue I am having now is that my app viewport does not fill the entire phone screen (black bars on top and bottom). Anyone else experience this? |
Yes, I solved the margin problem with meta viewport setting: <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My page</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover">
<link rel="icon" type="image/x-icon" href="assets/favicon/favicon.ico">
<script type="text/javascript" src="cordova.js"></script>
</head>
<body>
<root></root>
</body>
</html> |
I actually got it working by doing the following: |
I have been dealing with the same issue. It's a react app. I followed the cordova documentation. Added this config in my
cordova-plugin-ionic-webview plugin is not installed in the project. But still getting the white blank screen. |
@srinidhirao Following your suggestion I did the following After doing this i uploaded the ios build to app store for dummy testing. And I still got the warning from apple development community. Looking forward to some inspiration. |
This version of
This plugin has nothing to do with android. The WKWebView is an iOS concept. Also |
@breautek |
Don't know what to tell you. It sounds like you're going to need to refactor your app. Cordova generally don't support older major releases because they, generally speaking, are not accepted by Apple or Google for one reason or another. If you can't update to [email protected], then respectfully you're on your own. You can try forking |
Hey, I know, there is very little I can do here. But the option that you gave is worth a try given the limited options available for me. Although I am using svn as a repository and I am wondering how would i branch off the 4.5x and get the commit 715 on my local. Thanks in advance |
I'm not sure, its been ages since I last used SVN. But this is no longer the place for this kind of discussion, sorry. |
Thanks. No worries. |
This comment has been minimized.
This comment has been minimized.
As I said before, Cordova's stance is to upgrade your app to use the latest supported platform versions, which has the code necessary to be apple compliant. So if you're taking an unsupported direction I have to ask you to please stop posting on our github. Github is for us tracking issues. A more appropriate place for questions like this would be our slack. I cannot really answer your question because I'm not well knowledgeable in the native iOS code. But someone in our cordova-ios channel might be able to provide some general pointers. Thank you for your cooperation. |
this is a known WKWebView issue, you can use https://github.com/oracle/cordova-plugin-wkwebview-file-xhr to fix the problem, or move to cordova-ios 6 and use a custom scheme |
how to solve this issue? I have added the plugins but still their issue. how can I get this solve? |
Thank you so much! I did not have the |
I had to add following two lines to |
Hi All, What is the fix for this issue ?does it requires plist changes or configuration XML changes . I am seeing a white screen with no errors being shown on Safari inspector? |
You can update to the latest cordova-ios library which has a in-built support for wekwebview. If you do that, you don’t require this plugin to enforce WKWebview
…On 23 Sep 2021, 12:36 PM +0530, rohanawa ***@***.***>, wrote:
Hi All, What is the fix for this issue ?does it requires plist changes or configuration XML changes . I am seeing a white screen with no errors being shown on Safari inspector?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
My app is Cordova based angular app and I am having issues of white screen after app launch on the device only. Simulator doesnt have any issues. Added this config in my config.xml: cordova-plugin-wkwebview-engine plugin is not installed in the project. But still getting the white blank screen. |
When Cordova-ios 6.0.0 was released, the default UIWebView got updated with WKWebView. So, you don't have to install this plugin to get the WkWebview support which was required in older Cordova projects. Please check the docs: |
@srinidhirao From the documentation, I understand that cordova-ios 6.0.2 should work flawless without external plugins like cordova-plugin-wkwebview-engine and cordova-plugin-wkwebviewxhrfix. Also the line Then why does apple/testflight rejects app without the line Adding 'WKWebViewOnly' preference launches app with white screen indefinitely on the device but works well on simulator. If we try to fix white screen issue by removing 'WKWebViewOnly' preference in config.xml file, app loads the screen without issues in device and simulator. But this resolution will reject app from Testflight/Appstore. Any help to resolve the white screen issue and acceptance by TestFlight/appstore would be appreciated |
To check the white-screen issue, may be you can try debugging the app using the Safari Inspector as documented here: |
The preference was removed in 6.0 (effectively forcefully enabled) as there is no UIWebView anymore in the core platform to properly handle Apple's new requirements. The fact that changing this setting causes different behaviours tells me that something didn't update properly when you upgraded to I'd also suggest that you check and ensure that you're using the latest version of the
If you're upgrading from 5.1 using the wkwebview plugin, ensure the wkwebview plugin has been removed, as this will cause conflicts. If the issue still persists, white screens are generally JS errors which can be debugged using Safari's inspector as hinted above. Note that Safari does't report on log messages that occurred prior to the debugger being attached. You can work around this by refreshing the webview by pressing If you see no logs in the JavaScript console, then you may have to use XCode to view the native logs to gain more insight. Last few notes on Apple's deprecation message: Apache Cordova maintains two packages that may use the
If you use any of these plugins, be sure they are up to date. |
@breautek Thank you for your helpful advice! Now issue of white screen and rejection from apple is resolved. Changes I have done in the app are as below, but I really don't know which one of them really did work.
|
tanks a lot |
Bug Report
White screen after plugin install
Problem
I have bumped my cordova-ios version from 5.0.0 to 5.1.1 in order to use this plugin and remove uiwebview from project. When I add this plugin I now get a white screen with no errors. Any help would be greatly appreciated.
What is expected to happen?
App launch like normal but without uiwebview
What does actually happen?
App launches with white screen.
Information
Command or Code
Environment, Platform, Device
Version information
Checklist
The text was updated successfully, but these errors were encountered: