Closed megumih closed 5 years ago
Following I have the same issue, using a wkwebview engine in ipadOS 13 beta 2. When opening a page with the '_blank' target it loads the page and closes (or hides?) it directly.
Code is as follows:
const authWindow = cordova.InAppBrowser.open(getAuthorizationUrl(), '_blank', 'usewkwebview=yes');
Is this reproducible in a new, plain Cordova app? A minimal reproduction repository would really help to debug and later fix this issue. More information on how to create one: https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md
@janpio Thanks for the quick reply!
Here you can find my minimal reproduction repo (even the node_modules are checked in .. woeps) in ios 13 both on Ipad or Iphone (tested with Iphone XR & Ipad Air 3th gen) it opens and closes. I hope this helps :)
(one weird sidenote, on ios 12 it is an UIWebView and not an WkWebView)
Thanks @dlwsacrez.
@megumih Did you problem also concern usage with usewkwebview=yes
?
@dlwsacrez and @janpio thanks!
I try this one soon☺️
please help me! @dlwsacrez @janpio
I'm using this plugin. https://ionicframework.com/docs/native/in-app-browser
how to use usewkwebview=yes? this plugin haven't usewkwebview.
not working... cordova.InAppBrowser.open(XXXXX, '_blank', 'usewkwebview=yes');
I've done some preliminary investigation into this use my test harness project for this plugin.
Firstly I can confirm the issue is consistently reproducible:
when opening the inappbrowser using the WKWebView implementation (usewkwebview=yes
), the IAB window appears (the window is animated and webpage content can be seen to be loaded) but then the window immediately disappears.
There is no exception raised so the app does not crash - the window simply disappears.
See this screencapture for a visual representation of the issue.
In contrast, the UIWebView implementation on iOS (usewkwebview=no
) seems to work fine.
The [TraitCollection]
messages in the log output appear to be warnings new to iOS 13 as opposed to errors so don't appear to be the cause of the issue.
These can be seen in the initial startup of the test app:
The log output when opening the IAB using both the WKWebView & UIWebView implementations also show the [TraitCollection]
warning messages.
The console output for the two implementations is very similar and there's nothing that hints at the observed behaviour of the WKWebView implementation:
The question is: is the behaviour observed with the WKWebView implementation a bug with this plugin or a bug with the iOS 13 Beta?
Here is the relevant extract from my iPhone 7 running iOS 13 Beta 2 (17A5508m) during the period where the WKWebView window is being shown then disappears:
I can see no obvious cause indicated in that log, although several errors are logged.
For comparison here's the iPhone console output while opening the IAB using the UIWebView implementation:
Any update on this issue? I have also met the same issue using wkwebview
Just regression tested on iOS 13 Beta 3 (17A5508m) (note the build number is the same as Beta 2) and the issue is still present.
oh.... Who will fix this issue , Plugin side or Apple side?
Just regression tested on iOS 13 Beta 3 (17A5508m) (note the build number is the same as Beta 2) and the issue is still present.
I have the same issue on iOS 12.4 :( Anyone can fix it?
How to push this issue on top? :(
BTW I have noticed that there is no bug when you use https://github.com/ionic-team/cordova-plugin-ionic-webview. But when you use https://github.com/apache/cordova-plugin-wkwebview-engine bug exists.
@yoldar That's good to know. So maybe the underlying WKWebView implementation (rather than this plugin itself) is the cause of this. Also can be a workaround.
@yoldar I can't reproduce the issue on ios 12.4, can you make a demo repo? Also still have the issue in IOS 13 beta 5..
now,I'm working IOS 13 beta 5. InAppbrowser version in 3.1.1.
I have found very strange behavior. My application based on VueJs framework. I tried to debug this bug and have found that using VueJs and InAppBrowser + cordova-plugin-wkwebview-engine is always behave like this. If I run cordova.InAppBrowser.open('https://google.com', '_blank', 'location=no')
from Safari developer console it works fine. But when calling from VueJs is always immediately closes :(
OMG Finally I have found solution. Thanks to @oarsheo https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/140
So I removed cordova-plugin-wkwebview-engine
and cordova-plugin-wkwebview-file-xhr
. Than installed cordova-plugin-ionic-webview
(Because with this implementation of WKWebView InAppBrowser works normally). Than forked cordova-plugin-wkwebview-file-xhr
(I need this plugin to resolve CORS) and removed this row <dependency id="cordova-plugin-wkwebview-engine" />
and finally installed my fork of cordova-plugin-wkwebview-file-xhr
Downgrading the WKView might solve this issue. It's one of the temporary solutions until we are able to get a concrete one.
https://ionicframework.com/docs/v3/wkwebview/
you can do it by adding this in config.xml
<platform name="ios"> <preference name="CordovaWebViewEngine" value="CDVUIWebViewEngine" />
It's working for me.
Just give it a try.
Has anyone got any update on this? Downgrading to use CDVUIWebViewEngine is not really a permanent solution.
Setting usewkwebview=no
or yes
didn't make a difference for me.
Eventually I found out that it seems to work when starting a new (blank) project, which made me realise that there must be a conflict with another plugin installed OR I simply didn't have the latest version installed. The latter turned out to be the case. I managed to fix it as follows:
"cordova-plugin-inappbrowser": "^3.1.0"
in the package.json AND config.xmlusewkwebview
to no
as option: const authWindow = cordova.InAppBrowser.open('http://example.com', '_blank', { usewkwebview: 'no');
ionic cordova build ios
and try it out in a iOS 13 sim, and it should work!Btw, the browser does still crash when setting usewkwebview=yes, so if that's a requirement then this won't work. There is also Enterprise Support available from Ionic for this plugin which might work if you don't want to wait: https://ionicframework.com/docs/enterprise/inappbrowser#inappbrowser
@RikdeVos Interestingly for mine, before following your step, it wasn't crashing but rather the inappbrowser will pop up for less than a sec, then disappeared.
After those 4 steps, app starts crashing during open. Wondering how you install the 3.1.0 for inappbrowser? I just use the github link. What's weird is the current prod version of my app is build on top of inappbrowser 3.0.0 and Cordova 3, which has no issues at all. Tested on both iOS 13.0 beta and 13.1 beta.
I can reproduce this with cordova-plugin-ionic-webview
as well.
This is my simple demo app: https://github.com/NiklasMerz/repro-ios13iab The IAB closes on iOs 13 and stays open on iOS 12.
@yoldar How did you get Ionic WKWebView with IAB and usewkwebview
working?
Alrighty, found my solution. So, I'm not running with WKWebKit, but I'm running a combination of Cordova iOS 4.5 + inappbrowser 3.0.0, which was the cause of my issue. Upgrading to Cordova iOS 5.0.0 solves it.
This is probably releated to some changes in iOS 13 regarding ViewControllers.
Some links I found: https://medium.com/@hacknicity/view-controller-presentation-changes-in-ios-13-ac8c901ebc4e https://twitter.com/arekholko/status/1137756105050918912 https://developer.apple.com/videos/play/wwdc2019/224/ around 15 minutes
Does anybody have an idea where to look? @dpa99c I have been debugging this for hours and still don't have a clue what happens.
I found a soltution (partially) ! Honestly it's more of a workaround.
Like found in my links iOS 13 brings some changes to how modals work. These changes are in effect if the app is built using Xcode 11. So I tried building the app with Xcode 10 and uploaded it to testflight. Et voilà the app works on a iOS 13 device with this build from Xcode 10!
Looks like some of the changes affect the IAB modal. I still don't know which one because I couldn't find a viewctrl that has the presentationstyle automatic that has changed. I will keep looking for a solution.
The problem seems to be related to the tmpWindow used to present the InAppBrowser being destroyed right after presenting it. Can be fixed by having a reusable tmpWindow instead of generating it every time show is called.
Not really sure why the show method code involving the tmpWindow is so different from the UIWebView implementation to the WKWebView implementation
Thank you very much. Sounds like that's it. I will try that tomorrow and put together a PR if possible.
@jcesarmobile You saved me again. It works! I am not really sure why it was different, too. My tests worked and hidden as well.
Hi there! Thanks for taking care! Any idea on when the PR (https://github.com/apache/cordova-plugin-inappbrowser/pull/534) that fixes it is going to be merged?
Thanks @NiklasMerz - #534 fixes this for me on iOS 13. I'm using "cordova-plugin-wkwebview-engine" 🙏
@dpa99c - Will there be a new version published soon on npm with this fix?
@adityak74 that's above my pay grade 😀 for now install the plugin directly off the repo master branch.
@dpa99c - haha cool.
that's above my pay grade
You mean changing the version in package.json and typing npm publish
is above you pay grade?
@hthetiot by which I mean I have neither the authority nor the npm credentials required to perform a release.
You need to moderate your attitude, my friend. You are sailing close to (if not already) having breached the code of conduct. If this were my own repo, you'd already be banned.
I have neither the authority nor the npm credentials required to perform a release.
That better explanation than "above my pay grade". I thought was laziness, sorry if i offended you.
Apology accepted - "above my pay grade" was my euphemism for "I don't have the authority"
I tried building my PhoneGap app with the plugin directly from the repo master branch - {spec: 'https://github.com/apache/cordova-plugin-inappbrowser.git'}
Got the following error:
Cannot read property 'variables' of undefined
Any estimation for when a fix will be released? We use this plugin to help authenticate users for our Azure backend, which they can't do at the moment. Luckily we are still in development :)
Hi,
Please is there anyone who can told us when this fix will be available, it's really urgent :/ we are going soon to publish the app and we have some feature that doesn't work.
Thanks in advance.
Hi,
Please is there anyone who can told us when this fix will be available, it's really urgent :/ we are going soon to publish the app and we have some feature that doesn't work.
Thanks in advance.
Try to add plugin directly from repo:
cordova plugin rm cordova-plugin-inappbrowser cordova plugin add https://github.com/apache/cordova-plugin-inappbrowser.git
If using package.json add the package like this:
"cordova-plugin-inappbrowser": "git://github.com/apache/cordova-plugin-inappbrowser.git#<master latest commit hash>".
Bug Report
I'm creating ios13 app.
But ios13Beta2 is not working in InAppBrowser.
so select param '_blank', this app is crash.
This is error detail. [TraitCollection] Class _UIFullscreenPresentationController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.
My ionic environment
Ionic:
Ionic CLI : 5.0.3 (/Users/syoken/.nvm/versions/node/v12.4.0/lib/node_modules/ionic) Ionic Framework : ionic-angular 3.9.6 @ionic/app-scripts : 3.2.4
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1) Cordova Platforms : ios 5.0.1 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 1.2.1, (and 14 other plugins)
Utility:
cordova-res : not installed native-run : not installed
System:
ios-sim : 8.0.1 NodeJS : v12.4.0 npm : 6.9.0 OS : macOS Catalina Xcode : Xcode 11.0 Build version 11M337n
please tell me!
I only updated my plugin to 3.1.0 version and It works good. Regards
Try to add plugin directly from repo:
cordova plugin rm cordova-plugin-inappbrowser cordova plugin add https://github.com/apache/cordova-plugin-inappbrowser.git
This absolutely worked for me. 3.1.0 is the winner.
cordova plugin add https://github.com/apache/cordova-plugin-inappbrowser.git worked for me too. Thanks for the fix and immediate workaround!
Hi @amit777
I have try to use
cordova plugin add https://github.com/apache/cordova-plugin-inappbrowser.git
But for me doesn't work.
I use this code:
cordova.InAppBrowser.open(myURL, "_blank","")
How can I do? How do you use this?
My plugin version is: 3.1.1-dev And I haven't cordova-plugin-wkwebview-engine installed.
Bug Report
I'm creating ios13 app.
But ios13Beta2 is not working in InAppBrowser.
so select param '_blank', this app is crash.
This is error detail. [TraitCollection] Class _UIFullscreenPresentationController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.
My ionic environment
Ionic:
Ionic CLI : 5.0.3 (/Users/syoken/.nvm/versions/node/v12.4.0/lib/node_modules/ionic) Ionic Framework : ionic-angular 3.9.6 @ionic/app-scripts : 3.2.4
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1) Cordova Platforms : ios 5.0.1 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 1.2.1, (and 14 other plugins)
Utility:
cordova-res : not installed native-run : not installed
System:
ios-sim : 8.0.1 NodeJS : v12.4.0 npm : 6.9.0 OS : macOS Catalina Xcode : Xcode 11.0 Build version 11M337n
please tell me!