ionic-team / cordova-plugin-ionic-webview

Web View plugin for Cordova, specialized for Ionic apps.
Apache License 2.0
485 stars 393 forks source link

ios app stuck on splashscreen now . if i remove this plugin all working fine. #95

Open ipehimanshu opened 6 years ago

ipehimanshu commented 6 years ago

Hello now something wrong in this plugin or any other but if i remove this plugin then all working fine like app stuck on splashscreen.

screenshot_1 SauceLabs_Log_iPhone_6_free_16-04-2018_12-29-49.txt

ipehimanshu commented 6 years ago

here is my all plugin list

image and we use cli-7.1.0 as ios=4.5.4 and for this web view plugin we use this type configuration

`

<allow-navigation href="http://localhost:97011/*"/>
<feature name="CDVWKWebViewEngine">
  <param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />  `

it stuck on splashscreen not able to trace it more.

we are building application using phonegap build

Donil commented 6 years ago

I have the same issue. If use version "1.1.16" then application works correctly.

dodomui commented 6 years ago

I am facing the same problem. Tried version 1.1.16 the problem still there. Can solved by uninstall this plugin, any side effect?

ghost commented 6 years ago

I'm facing a similar problem. I found when I am using wifi, everything goes well, but in 4g the splash screen will stop there for about 30 secs. After I installed cordova-plugin-wkwebview-ionic-xhr, the problem was solved.

jacquesdev commented 6 years ago

This issue should be fixed once these issues get merged in: https://github.com/ionic-team/cordova-plugin-ionic-webview/pull/110 https://github.com/ionic-team/cordova-plugin-ionic-webview/pull/41

110 is already merged, and hopefully, #41 will be done soon (I'm working on it)

thiphariel commented 6 years ago

@jacquesdev Hi, do you know when #41 will be merged ? I also faced this bug on a production app. For now, I reinstalled the plugin on the top of the 1.x branch to get your #110 merged, but still, I wonder if this issues only will fixed that bug.

EDIT : Oh, I just saw that the #117 is for the v2 beta... @jacquesdev Did you switch to v2 ? For now I just can't ...

Thanks

jacquesdev commented 6 years ago

@thiphariel, I have not switched yet, but as I understand it’s basically the same.

So I will be switching soon.

thiphariel commented 6 years ago

@jacquesdev I tried the v2 beta (without ionic-native wrapper cause I can't upgrade this one) with the @ghenry22 fork (#117), but I still have this bug... Could it be plugins incompatibility ? This bug is really random and I can't reproduce it myself yet (just clients echoes for now)

Here is my cordova plugin ls :

com.googlemaps.ios 2.6.0 "Google Maps SDK for iOS"
cordova-background-geolocation 2.11.0-beta.4 "BackgroundGeolocation"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-background-fetch 5.3.0 "CDVBackgroundFetch"
cordova-plugin-badge 0.8.7 "Badge"
cordova-plugin-cocoalumberjack 0.0.4 "CocoaLumberjack"
cordova-plugin-datepicker 0.9.3 "DatePicker"
cordova-plugin-device 2.0.1 "Device"
cordova-plugin-email-composer 0.8.15 "EmailComposer"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-googlemaps 2.1.1 "cordova-plugin-googlemaps"
cordova-plugin-inapppurchase 1.1.0 "In App Purchase"
cordova-plugin-ionic-webview 2.0.0-beta.1 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-nativestorage 2.3.1 "NativeStorage"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-screen-orientation 3.0.1 "Screen Orientation"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.1 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-zip 3.1.0 "cordova-plugin-zip"
es6-promise-plugin 4.2.2 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
mx.ferreyra.callnumber 0.0.2 "Cordova Call Number Plugin"
onesignal-cordova-plugin 2.3.1 "OneSignal Push Notifications"
jacquesdev commented 6 years ago

@thiphariel, I have the same issue. It looks like the changes that @ghenry22 made did not make the issue go away unfortunately.

I know there were a couple of additional settings to be done in xcode which (i assumed) I did, but my clients still experience it, and I can’t recreate it. It also seems to slow things down for the app when resumed so that some ui elements don’t load properly.

thiphariel commented 6 years ago

@jacquesdev Yup, same for me. Except the resume thing, I did not experienced a behaviour like that

ghenry22 commented 6 years ago

My changes are to allow background operation of javascript processing for the web view.

I don’t have any issues with the splashscreen at all in my apps.

I have seen this behaviour once before when the app is triggered in the background by a notification and doesn’t fully launch. On the next clean launch the app is already in a broken state and will hang at the splashscreen.

To fix this particular scenario there is another PR related that was just a small javascript change that addressed this exact issue where someone was experiencing it with a VOIP app where a notification would wake the app in the background but it wouldn’t fully load and would then be in a broken state.

thiphariel commented 6 years ago

@ghenry22 Are you talking about #45 ? Do you know why it's not totally merged into this repo ?

RichardLewin87 commented 6 years ago

I have also recently been experiencing this issue with the plugin when the app is booted in the background via a VoIP push. After looking here I noticed the pull request #58 that upon trying out resolved my problems. I was therefore happy to see that that the pull request was closed due to #117. I noticed that this has been merged into the master branch so I pulled from the latest code on master hoping for the fix to be in but I am back to having the app not fully load again.

If it helps, I have though found that I can repeat the situation of the app not fully loading in the background via a VoIP push if either the phone has been rebooted and the app has NOT been opened already or the app has been force killed by me. If however the app is been started already and then killed by the OS after going into the background then the app fully loads in the background with a VoIP push.

ghenry22 commented 6 years ago

https://github.com/ionic-team/cordova-plugin-ionic-webview/pull/58

this is the one I was talking about. This is a tiny change to the javascript only and resolved the problem I mentioned above which can cause the symptoms with the splash screen hanging.

thiphariel commented 6 years ago

So basically, #58 has never been merged into this repo ? I gonna try this and see if it solve the splashscreen bug. Thanks

jacquesdev commented 6 years ago

@thiphariel - any luck on this? I also read about this possible solution: https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/95#issuecomment-382599735

Will try that in the meantime

thiphariel commented 6 years ago

Hi. I switched to the beta v2 webview and the problem is nearly gone on iOS side. Still got some issues but they are really few so I'm ok with this right now.

ghenry22 commented 6 years ago

I have submitted a new PR to beta2 which merges the changes from that other PR which should resolve this. You will also need to set the suspend in background value to FALSE in your config.xml. Once done this should be resolved.

Provided of course that background launching of the app was the cause of your issue. There may of course be other causes of the issue but this is the only time I have seen it and this resolved the issue in an app I was working on.

Bengejd commented 6 years ago

Are we going to get any feedback on any of these issues? Or is it going to be typical Ionic Team where breaking issues in the framework go ignored for years until the next version is released? Hoping for a fix for this by Ionic v5.

kevryan2 commented 6 years ago

On cold-start of the application I can confirm this issue exists. But if you start the app, force close as it's stalled on splash screen, and restart, then it loads perfectly fine. I'm using v1.1.16 of this plugin, and as I don't typically enjoy updating all packages when a product is operating fine (since newer versions always tend to come with a host of new issues of their own), can anyone confirm that a newer version of this plugin solves the issue? Thanks!

ghenry22 commented 6 years ago

If you install the latest version directly from the github repo it has a fix for this merged now.

You must set the WKSuspendInBackground option to FALSE in your config.xml when you have the latest version installed and you should be good to go.

kevryan2 commented 6 years ago

@ghenry22 thanks for the quick response, will try this upgrade today and post confirmation it's fixed as soon as I am able to test

kevryan2 commented 6 years ago

I can confirm that this seems to fix this issue (will continue to test as sometimes it takes 12+ hours of an app being closed to experience this, but so far so good!), upgrading and adding <preference name="WKSuspendInBackground" value="false" /> to config.xml should be the accepted answer here so far.

(P.S. this is a topic for a different thread I just started (https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/148), but upgrading does however cause significant issues using locally stored assets on iOS which will be a huge issue for us and I will need to switch back asap if I can't find a workaround, even after following the suggested switch from normalizeURL to convertFileSrc; note that this does work on Android) @ghenry22 have you guys run into this at all/have suggestions?)

LufoX11 commented 5 years ago

Oh God... 16 Apr - 26 Sep now and issue is still there... I'm praying for the above solution to magically fix it.

ghenry22 commented 5 years ago

Get the latest version of the plugin, set the config.xml values to enable background mode, add the appropriate background mode capability for what your app is doing in Xcode (ie remote notifications, geolocation, background fetch etc).

That should resolve the issue, it has for me in every case where I was seeing this.

It resolves the case where your app is triggered in background by a remote notification and then is hung when you bring it to the foreground.

It also resolved the case where after the operating system suspends the app in the background and you bring it back to the foreground some hours or a day later where open sockets to the built in web server get stuck in an error State and not reset so again it would hang at the splashscreen.

ghenry22 commented 5 years ago

@KevRyan2, try the latest version there were a few bugs fixed related to access to local resources, particularly audio/video resources and errors when trying to access a file that didn’t exist.

kevryan2 commented 5 years ago

@ghenry22 awesome thank you, I will test that this asap when I return to this project. excited to be able to fully upgrade and take advantage of all the optimizations that have been made

write2sv commented 5 years ago

Hi @ghenry22 I am facing the below issue when using WKSuspendInBackground=false. Any help on this would be greatly appreciated.

https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/189

graemeenglish commented 5 years ago

Note: I've seen the stuck splashscreen (ios) when I have two versions (different environments) of my app installed on the same device. Switching between them and doing things like showing toast while backgrounding seems to cause a crash. After that the crashed app gets stuck on splash each time it starts until I force close the other, however ensuring I have a different WKPort for each environment seems to cure it.

https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/165

larsvliet commented 5 years ago

I'm experiencing the same issue with this plugin. I've narrowed it down to the following scenario:

Above scenario is observed by setting various breakpoints in the CDVWKWebViewEngine class:

ghenry22 commented 5 years ago

Could you check a few things: 1) make sure you have the latest version of the plugin 2) make sure that you have the suspendinbackground option set to false in your config.xml 3) make sure that you have appropriate background capabilties enabled in xcode for your app. In this case I guess the geolocation options and potentially background fetch if you intend to actually do anything online in the background.

I have had the same issue with a remote notification waking the app in the background which is why I submitted fixes for the plugin to address it and they have been working for me in several scenarios. They should also work for background geo-location triggers as far as I know.

It is correct that the webview starts in the background when the app is started, it has to otherwise your app isn't started and cannot do anything. The issue is that by default wkwebview does not process any javascript at all in the background, so while your app will "wake up" the native portion of the code will run, the javascript portion will not even try to run until the app comes to the foreground, which means things like platform.ready will never fire etc so when you bring it to the foreground the native part thinks everything is running and the javascript part thinks it is starting up from cold and it all goes horribly wrong.

ghenry22 commented 5 years ago

also make sure you are testing on a real device. Behaviour on the simulator is distinctly different to real devices for background mode, geolocation and various other things.

larsvliet commented 5 years ago

Hi @ghenry22,

I've gotten the latest version of all plugins and also have the background capabilities set. I can also reproduce this on the real device.

Actually what I want (and I do think this should be supported) is to have this working with WKSuspendInBackground true. Because I see this more like a workaround setting this to false. Setting WKSuspendInBackground to false does remove this problem but gives extra battery drainage and is not mandatory for our solution because we handle the geofences in native code.

ghenry22 commented 5 years ago

@larsvliet it’s impossible to have this work with suspendinbackgroundtrue, the webview does not run at all in the background with that setting so it will never work. This is a quirk of unfortunately.

The suspendinbackground false setting still abides by all of the OS power saving requests, will still allow the app to be suspended normally in the background if it is idle etc so impact on battery should be minimal.

Even though you handle the Geo fence in active code the app needs to be able to start and will then be automatically suspended by the OS after the normal idle time out.

All this setting is doing is making the webview behaviour the same as uiwebview and android, it doesn’t do anything nasty to try and keep the app alive longer than it should be like the background mode plugin does.

giladrom commented 5 years ago

This seems to be broken on 3.1.2 - the webview turns into a white screen when opening the app again after it has been suspended.

jrista commented 5 years ago

I have been having the same issue today, having just added cordova-plugin-ionic-keyboard and cordova-plugin-ionic-webview to my app. I need the functionality this keyboard plugin offers, and it seems to be dependent on the webview plugin.

I've tried debugging the app with XCode, and while the app on the device (physical iphone) gets stuck on the splash screen, I see the following log in the xcode debug log (after the last line here the app dies, even though the splash screen remains visible):

2019-02-14 12:05:28.340492-0700 WICShopper[722:251610] DiskCookieStorage changing policy from 2 to 0, cookie file: file://...
2019-02-14 12:05:28.749554-0700 WICShopper[722:251610] Apache Cordova native platform version 5.0.0 is starting.
2019-02-14 12:05:28.751269-0700 WICShopper[722:251610] Multi-tasking -> Device: YES, App: YES
2019-02-14 12:05:28.786682-0700 WICShopper[722:251610] CDVWKWebViewEngine: trying to inject XHR polyfill
2019-02-14 12:05:28.831315-0700 WICShopper[722:251610] -[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]: unrecognized selector sent to instance 0x1568cde0
2019-02-14 12:05:28.832196-0700 WICShopper[722:251610] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]: unrecognized selector sent to instance 0x1568cde0'
*** First throw call stack:
(0x1d1dfb3d 0x1c467067 0x1d1e4fd1 0x1d1e30c3 0x1d10bdc8 0x217ead 0x22c4cb 0x22bc6b 0x22c109 0x2297a9 0x10553f 0x22411eb7 0x22411ad9 0x2241805b 0x224155bb 0x22485159 0x21f5a1 0x105315 0x224815c5 0x22682a4b 0x22687c1d 0x2269a7c5 0x2268535b 0x1eac0c13 0x1eac0acd 0x1eac0db7 0x1d19bfdd 0x1d19bb05 0x1d199f51 0x1d0ed1af 0x1d0ecfd1 0x2247ae2d 0x22475a53 0x105213 0x1c8da4eb)
libc++abi.dylib: terminating with uncaught exception of type NSException

I am an ionic/angular developer, I don't get into native iOS/Android code except every great once in a while. I am not sure what this selector is referring to, but I gather it is an ObjectiveC thing.

I desperately need to get both of these plugins working Hopefully the above exception report will help someone identify the problem here and resolve it soon.

albernaz commented 5 years ago

Same issue here. Just started a blank project with ionic start xxx tabs.

I've resolved my issue like this: on XCode my build target was iOS 10.3 so last version compatible is cordova-plugin-ionic-webview 2.3.1 [https://github.com/ionic-team/cordova-plugin-ionic-webview/blob/master/CHANGELOG.md]

sudo ionic cordova plugin rm cordova-plugin-ionic-webview sudo ionic cordova plugin add cordova-plugin-ionic-webview@2.3.1

Solved my issue.

ziyaddin commented 5 years ago

Some people may face this problem due to not including

<allow-navigation href="http://localhost:CUSTOM_PORT_NUMBER/*"/>

in their config.xml file, after adding

<preference name="WKPort" value="CUSTOM_PORT_NUMBER" />
alexialina commented 5 years ago

Thank ziyaddin it work for me i user version 4.0.1 cordova-plugin-ionic-webview. in config.xml file add

dopplerDistortion commented 4 years ago

For those who are experiencing stuck on splash screen issue, I solved my problem reverting back config.xml. Just updated the plugin. It is working fine right now. I hope this solves your problem.

tryhardest commented 4 years ago

@dopplerDistortion can you explain that please? Revert config.xml back to what? Upgrade plugin sure, but what's being reverted.

josephnunes commented 4 years ago

Como resolver isso?

codemis commented 3 years ago

I am using version 5.0.0 of this plugin.

I was able to fix it by following the suggestions on this issue. First, I added the following in the config.xml under platform ios:

<feature name="CDVWKWebViewEngine">
    <param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

I also verified that I removed the following from the config.xml file:

<preference name="WKWebViewOnly" value="true" />

Finally, I upgraded the splashscreen plugin:

ionic cordova plugin rm cordova-plugin-splashscreen
ionic cordova plugin add cordova-plugin-splashscreen

💥 It worked! I hope that helps.

josevavia commented 3 years ago

Same problem here, using ios@6.2.0, and resolved with the steps by codemis! Thank you so much