apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.16k stars 989 forks source link

App Stuck on Splash screen #938

Closed ashishkumar2804 closed 4 years ago

ashishkumar2804 commented 4 years ago

Bug Report

App is tuck on Splash screen/launch screen post updating to cordova ios platform 6.1. When checked through safari, even device ready event is not triggered.

What is expected to happen?

App should launch with device ready event triggering and launch screen disappearing

What does actually happen?

App is stuck on launch screen

Information

No error is displayed on the Xcode console.

Command or Code

Environment, Platform, Device

IPad 13 device using xcode 11 and cordova 6.1.0

Version information

Checklist

ashishkumar2804 commented 4 years ago

Attaching log details of the Xcode

2020-07-10 17:56:25.373664+0530 Reports[1058:128594] Apache Cordova native platform version 6.1.0 is starting. 2020-07-10 17:56:25.373787+0530 Reports[1058:128594] Multi-tasking -> Device: YES, App: YES 2020-07-10 17:56:25.386283+0530 Reports[1058:128594] Could not load the "DefaultOS7-Portrait.png" image referenced from a nib in the bundle with identifier "xxxxxx" 2020-07-10 17:56:25.425070+0530 Reports[1058:128594] The preference key "AllowNewWindows" is not defined and will default to "FALSE" 2020-07-10 17:56:25.427466+0530 Reports[1058:128594] The preference key "MediaPlaybackAllowsAirPlay" is not defined and will default to "TRUE" 2020-07-10 17:56:25.431295+0530 Reports[1058:128594] The preference key "AllowBackForwardNavigationGestures" is not defined and will default to "FALSE" 2020-07-10 17:56:25.431487+0530 Reports[1058:128594] The preference key "Allow3DTouchLinkPreview" is not defined and will default to "TRUE" 2020-07-10 17:56:25.431609+0530 Reports[1058:128594] CDVWebViewEngine will reload WKWebView if required on resume 2020-07-10 17:56:25.431731+0530 Reports[1058:128594] Using WKWebView 2020-07-10 17:56:25.432100+0530 Reports[1058:128594] [CDVTimer][console] 0.065923ms 2020-07-10 17:56:25.432297+0530 Reports[1058:128594] [CDVTimer][handleopenurl] 0.059962ms 2020-07-10 17:56:25.433114+0530 Reports[1058:128594] [CDVTimer][intentandnavigationfilter] 0.699997ms 2020-07-10 17:56:25.435806+0530 Reports[1058:128594] [CDVTimer][gesturehandler] 0.071049ms 2020-07-10 17:56:25.437137+0530 Reports[1058:128594] [CDVTimer][statusbar] 1.184940ms 2020-07-10 17:56:25.437492+0530 Reports[1058:128594] [CDVTimer][inappbrowser] 0.076056ms 2020-07-10 17:56:25.449660+0530 Reports[1058:128594] [CDVTimer][file] 12.095928ms 2020-07-10 17:56:25.449782+0530 Reports[1058:128594] [CDVTimer][TotalPluginStartup] 17.803907ms 2020-07-10 17:56:25.470351+0530 Reports[1058:128594] Hiding blur 2020-07-10 17:56:25.470662+0530 Reports[1058:128594] active 2020-07-10 17:56:25.471651+0530 Reports[1058:128594] PushPlugin skip clear badge 2020-07-10 17:56:25.582081+0530 Reports[1058:128594] IAB.close() called but it was already closed. 2020-07-10 17:56:26.064342+0530 Reports[1058:128594] The preference key "AutoHideSplashScreen" is not defined and will default to "TRUE" 2020-07-10 18:02:02.886313+0530 Reports[1058:129461] [general] Connection to daemon was invalidated

breautek commented 4 years ago

Generally speaking this is usually caused by a javascript error.

With the app displayed at the splashscreen, I'd try opening the Safari Developer Tools to do remote inspection.

Safari Dev Tools don't record javascript errors when it was not opened, so then you should refresh the web page. You can do this by pressing cmd + r while having the dev tools window focused.

Please inform what you find by doing this, thanks.

ashishkumar2804 commented 4 years ago

Will be trying that, but i have applied some console log, which gets displayed on Xcode console at device ready event. the same where not showing up.

breautek commented 4 years ago

Will be trying that, but i have applied some console log, which gets displayed on Xcode console at device ready event. the same where not showing up.

This also suggest that one of your plugins isn't initialising properly. If this is the case, you can start removing plugins one by one until the problem "fixes" itself. Then you'll know which plugin is the culprit.

ashishkumar2804 commented 4 years ago

For the error log and it is related to CORS. Any idea on how to get that fixed?

Screenshot 2020-07-10 at 6 19 37 PM
timbru31 commented 4 years ago

Configure your backend servers to solve CORS issues. ;)
We can't assist with that.

The MDN docs are a good starting point to understand CORS: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

breautek commented 4 years ago

There's an open issue on this already at https://github.com/apache/cordova-ios/issues/883

First I'd read this comment: https://github.com/apache/cordova-ios/issues/883#issuecomment-637559770

If possible I'd use URL schemes.

If you must stay on the file:// protocol for whatever reason (such as can't afford losing access to web storage data in local storage/cookies/etc), then read this comment: https://github.com/apache/cordova-ios/issues/883#issuecomment-651476010

Do let me know if this helps and if this issue can be closed.

Configure your backend servers to solve CORS issues. ;) We can't assist with that.

He's requesting a local file:// url, so that doesn't apply here.

timbru31 commented 4 years ago

He's requesting a local file:// url, so that doesn't apply here.

Oh, indeed. I've missed that.

engrsandeep commented 4 years ago

remove splash screen plugin and install again. splash plugin is not required for ios ^6.0.0. So reinstall splash screen plugin solve the issue.

mosabab commented 4 years ago

This maybe because your HTML and JS not perform well. (You maybe run Other JS code before cordova.js code start)

The best you can do is to make cordova.js the first javascript file to run in your project and HTML file structure should be like this:

<!DOCTYPE html> <html> <head> .. .. </head> <body> .. .. .. .. <script src="cordova.js"></script> <script src="js/index.js"></script> ... Other js codes (if you have) should be here... .... .... </body> </html>

And for index.js it should looks like this:

//index.js //First line should start with deviceready event following with onDeviceReady function

document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() { // Cordova is now initialized. Have fun! //..................... //............... }

So, you should not run any js code before Cordova.

ashishkumar2804 commented 4 years ago

@breautek : How do i use custom scheme, and what affect it will have? I tried adding preferences in config xml, that solved loading of index.html issue, but there is still issue with sql lite plugin, it says undefined is not an object evaluating window.sqlliteplugin. This all used to work with cordova ios 5.0.1.

I have removed and re-added all the plugins.

ashishkumar2804 commented 4 years ago

I have added below two preference in config file,

<preference name="scheme" value="app" /> <preference name="hostname" value="localhost" />

the error related to CORS got removed, but looks like plugins are not loading or something. below is the new error I am seeing.

Screenshot 2020-07-14 at 3 38 46 PM

Not sure what I am missing here.

ashishkumar2804 commented 4 years ago

To Add to the above issue, i don't think the issue is related to specefic plugin, and it is more on how they are getting included. If i remove the custom config parameter plugin, the issue start coming up in the next plugin, in my case being the sql cipher adapter.

I also checked plugin js and they all are displayed in debugger tab of safari including cordova.js and cordova-plugin.js etc

engrsandeep commented 4 years ago

@ashishkumar2804 use 5.1.0 until it stable release, i had tried and got it working but then its screen size issue arise and other issues encountered.

ashishkumar2804 commented 4 years ago

@engrsandeep Have you submitted your app with 5.1.0. without getting deprecated API warning..? I have InappBrowser being used in my app and cookies as well, which was not working with Wkwebview.

engrsandeep commented 4 years ago

For this, remove splash screen plugin and add again. cordova-ios ^6.0.0 do not use splash screen plugin.

ashishkumar2804 commented 4 years ago

the app doesn't use splash screen plugin, i have launch screen storyboard for that.

breautek commented 4 years ago

I have added below two preference in config file,

<preference name="scheme" value="app" /> <preference name="hostname" value="localhost" />

the error related to CORS got removed, but looks like plugins are not loading or something. below is the new error I am seeing.

Screenshot 2020-07-14 at 3 38 46 PM

Not sure what I am missing here.

That looks like a third-party plugin problem, we can't really assist you here.

Since the issues that were relating to cordova-ios has been resolved, and in the stacktrace of that plugin error, I see that onDeviceReady is being called, the original bug appers to be resolved, so I'll be closing this issue. I'd advise contacting the plugin maintainers for assistance for your db plugin.

angelofan commented 4 years ago

@engrsandeep

For this, remove splash screen plugin and add again. cordova-ios ^6.0.0 do not use splash screen plugin.

should I uninstall cordova-plugin-splashscreen?

engrsandeep commented 4 years ago

you can remove if app is only for iOS. it might be required for Android. but you will need to uninstall and install again. Splash screen plugin not required for iOS as cordova-ios ^6.0.0 uses storyboard image.

breautek commented 4 years ago

The latest version of splashscreen plugin has a check for cordova-ios < 6.0.0. If cordova-ios@6 is present, it won't be installed for that platform.

The splashscreen is still required for other platforms, including android.

angelofan commented 4 years ago

How to hide the startup screen programmatically and show loading animation on startup screen?

I opened this issue for help.

jabalmarouane commented 3 years ago

uninstall and install : cordova-plugin-splashscreen install :

cordova-plugin-add-swift-support cordova-plugin-ionic-webview

config .xml :

<preference name="UseSwiftLanguageVersion" value="5" />
<preference name="scheme" value="app" />
<preference name="hostname" value="localhost" />
itshazlan commented 1 year ago

uninstall and install : cordova-plugin-splashscreen install :

cordova-plugin-add-swift-support cordova-plugin-ionic-webview

config .xml :

<preference name="UseSwiftLanguageVersion" value="5" />
<preference name="scheme" value="app" />
<preference name="hostname" value="localhost" />

still does not resolve my problem, my app using cordova-sqlite-storage which is got me suspicious about that compatibility support with wkwebview