EddyVerbruggen / cordova-plugin-safariviewcontroller

:tiger: :elephant: :crocodile: Forget InAppBrowser for iOS - this is way better for displaying read-only web content in your PhoneGap app
MIT License
281 stars 143 forks source link

SafariViewController appears blank #56

Open hobzcalvin opened 7 years ago

hobzcalvin commented 7 years ago

I have a call to SafariViewController.show({hidden:false, animated:true, url:"https://facebook.com") wrapped in a call to SafariViewController.isAvailable(), as the docs suggest. The SVC slides into view as expected, but it is completely blank and unusable. The "opened" event is fired (since it's just at the bottom of show) but "loaded" is not. However, if I put up a window.alert() or setTimeout(>0) before calling show(), everything works as expected! I've added lots of NSLog()s to SafariViewController.m and everything looks fine: it isn't hidden, and we get to the bottom of the ObjC show method without issue. The delegate methods are never called.

This is on my iPhone 5S running iOS 9.3.5. Cordova 5.3.3, iOS engine 4.3.1. Plugins:

com.shoety.cordova.plugin.inappbrowserxwalk 0.3.3 "InAppBrowser Crosswalk" cordova-plugin-app-event 1.2.0 "Application Events" cordova-plugin-crosswalk-webview 1.5.0 "Crosswalk WebView Engine" cordova-plugin-customurlscheme 4.1.5 "Custom URL scheme" cordova-plugin-device 1.1.2 "Device" cordova-plugin-dialogs 1.2.1 "Notification" cordova-plugin-inappbrowser 1.3.0 "InAppBrowser" cordova-plugin-restrict-keyboard 1.0 "Restrict Keyboard" cordova-plugin-safariviewcontroller 1.4.6 "SafariViewController" cordova-plugin-splashscreen 3.2.2 "Splashscreen" cordova-plugin-statusbar 2.1.3 "StatusBar" cordova-plugin-whitelist 1.2.2 "Whitelist" cordova-universal-links-plugin 1.1.2 "Universal Links Plugin" de.appplant.cordova.plugin.local-notification 0.8.5-dev "LocalNotification" io.hpd.cordova.gimbal2 1.0.1 "Gimbal2" phonegap-plugin-push 1.5.3 "PushPlugin"

hobzcalvin commented 7 years ago

I must admit that this seems related to our use of the in-app browser, which if closed too soon before our SVC calls messes things up. So this may not be a widely-experienced bug. Still, I'm at a loss: the ObjC seems to think everything's fine, until it's not.

redborian commented 7 years ago

@hobzcalvin I am facing a similar issue as you (in iOS). When I reopen the SafariViewController that was just closed before, I get a blank page. I tried modifying the plugin to fire the pluginresult in the "completion" callback of "dismissViewControllerAnimated" but to no avail. Can you elaborate on how you fixed the issue?

hobzcalvin commented 7 years ago

We "fixed" it by waiting 500ms between closing one browser and opening the other :-(

redborian commented 7 years ago

I initially tried with timeout as well and it "worked". I turned off the animation and it seems to be working now without the timeout :). Thanks @hobzcalvin !