apache / cordova-ios

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

Stuck on White Screen after Launch StoryBoard in iOS #975

Closed pratikgohil1985 closed 3 years ago

pratikgohil1985 commented 4 years ago

Issue Type

Description

When we run app on iOS Device, first story board screen is displayed and after that white screen appears. This white screen remains forever, this screen look like a browser and is re-sizable with background imgpsh_mobile_save Untitled

Information

Following is debugger output from XCode 2020-08-27 15:03:46.102298+0530 MBAZ[89517:4250528] Apache Cordova native platform version 6.1.0 is starting. 2020-08-27 15:03:46.102636+0530 MBAZ[89517:4250528] Multi-tasking -> Device: YES, App: YES 2020-08-27 15:03:54.956810+0530 MBAZ[89517:4250528] WF: === Starting WebFilter logging for process MBAZ 2020-08-27 15:03:54.957126+0530 MBAZ[89517:4250528] WF: _userSettingsForUser : (null) 2020-08-27 15:03:54.957334+0530 MBAZ[89517:4250528] WF: _WebFilterIsActive returning: NO 2020-08-27 15:03:58.123221+0530 MBAZ[89517:4250528] The preference key "AllowNewWindows" is not defined and will default to "FALSE" 2020-08-27 15:03:58.128514+0530 MBAZ[89517:4250528] The preference key "MediaPlaybackAllowsAirPlay" is not defined and will default to "TRUE" 2020-08-27 15:03:58.134558+0530 MBAZ[89517:4250528] WF: _userSettingsForUser : (null) 2020-08-27 15:03:58.134749+0530 MBAZ[89517:4250528] WF: _WebFilterIsActive returning: NO 2020-08-27 15:03:58.137071+0530 MBAZ[89517:4250528] The preference key "AllowBackForwardNavigationGestures" is not defined and will default to "FALSE" 2020-08-27 15:03:58.137267+0530 MBAZ[89517:4250528] The preference key "Allow3DTouchLinkPreview" is not defined and will default to "TRUE" 2020-08-27 15:03:58.137440+0530 MBAZ[89517:4250528] CDVWebViewEngine will reload WKWebView if required on resume 2020-08-27 15:03:58.137651+0530 MBAZ[89517:4250528] Using WKWebView 2020-08-27 15:03:58.138347+0530 MBAZ[89517:4250528] [CDVTimer][console] 0.131965ms 2020-08-27 15:03:58.138709+0530 MBAZ[89517:4250528] [CDVTimer][handleopenurl] 0.169039ms 2020-08-27 15:03:58.330333+0530 MBAZ[89517:4250528] [CDVTimer][intentandnavigationfilter] 191.444039ms 2020-08-27 15:03:58.330976+0530 MBAZ[89517:4250528] [CDVTimer][gesturehandler] 0.151992ms 2020-08-27 15:03:59.121388+0530 MBAZ[89517:4250528] [CDVTimer][file] 790.216088ms 2020-08-27 15:03:59.121615+0530 MBAZ[89517:4250528] [CDVTimer][TotalPluginStartup] 983.518958ms 2020-08-27 15:04:54.422604+0530 MBAZ[89517:4250528] THREAD WARNING: ['Badge'] took '75.721191' ms. Plugin should use a background thread. 2020-08-27 15:04:56.735901+0530 MBAZ[89517:4250528] THREAD WARNING: ['Device'] took '2127.536377' ms. Plugin should use a background thread. 2020-08-27 15:04:57.122217+0530 MBAZ[89517:4250528] THREAD WARNING: ['File'] took '385.750977' ms. Plugin should use a background thread.

Command or Code

Config.xml File:- config.zip

Environment, Platform, Device

We have tested this on iOS 13.6 iPhone 8 Emulator as well as iPhone 7 actual device. both giving same results. Built on Xcode 11 on Mac OS 10.15.6

Version information

Cordova CLI : 10.0.0 Cordova-ios : 6.1.0

Checklist

Akhilp18 commented 4 years ago

Hi, I am also facing the same issue. Anyone if can suggest a resolution on this will be highly appreciated.

breautek commented 4 years ago

Usually this behaviour signals a javascript error, that occurred on startup.

I would recommend checking the safari web inspector for javascript errors. Do note that safari doesn't report on logs that occurred before the web inspector is attached. Therefore, you'll need to use cmd+r while the inspector is focused to refresh the webview to see javascript errors that occur on startup.

pratikgohil1985 commented 3 years ago

Thanks @breautek for reply but there is no javascript issue. App works properly on Android Platform too. I have tried by creating a blank hello Angular 10 ,Cordova 10 & Cordova-ios 6.1 Project with no other plugins. Still same issue persists in iOS.. What am I missing?? Is there some config.xml setting that I'm missing

zhangv commented 3 years ago

For my case, it usually caused by some js error. To debug it, I added the eruda.js to the index.html:

<script src="/PATH/TO/eruda.js"></script>
<script>eruda.init();</script>

Then, you can view the error from eruda console. Hope it helps.

colinpieper commented 3 years ago

In my setup (Cordova 6, AngularJS 1.8), I was getting a white screen when loading on iOS. In Xcode, I got the error "ERROR: [$templateRequest::tpload]" with error status -1. Turns out it was a CORS issue regarding loading locally stored files via file://. The issue was resolved after adding the "cordova-plugin-wkwebview-file-xhr" plugin.

phusting commented 3 years ago

I have this same issue too. I've also posted to the Slack channel for any suggestions.

gabmueller commented 3 years ago

Could be the same problem as in https://github.com/ionic-team/ionic-cli/issues/3218.

As already mentioned by @breautek you should look for javascript errors. Try to use the Web Inspector of Safari to debug on your Iphone. Do not forget to reload the app via the Web Inspector (button top left) "to see javascript errors that occur on startup".

If your output looks somewhat like the following

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (runtime.js, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (cordova.js, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (polyfills.js, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (styles.js, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (vendor.js, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (main.js, line 0)

you should try to run

cordova plugin rm cordova-plugin-ionic-webview
cordova plugin add cordova-plugin-ionic-webview@latest

to resolve the issue of the blank screen. This solution was suggested here, you should check it out for more details.

prabhashibuddhima commented 3 years ago

Hi,

Have you solved the issue? I'm having the same issue and I check Safari logs also, there were no error logs.

phusting commented 3 years ago

Hi,

Have you solved the issue? I'm having the same issue and I check Safari logs also, there were no error logs.

Yes, on the General Tab of xCode, make sure you MULI-WINDOWS is not checked. Cordova doesn't support multi windows which can be used on iPad Pros, etc.

claudiulazar commented 3 years ago

If you have blank screen, open the safari inspector and reload the page from there Screenshot 2021-02-16 at 21 56 03

Afterwards if you have some error in the console that can not load the resources it may be the problem that @Gab309 said

Solution: run the following command, this worked for me :) cordova plugin rm cordova-plugin-ionic-webview && cordova plugin add cordova-plugin-ionic-webview@latest

breautek commented 3 years ago

Closing because I think it's pretty clear that there isn't a cordova bug here.

As described https://github.com/apache/cordova-ios/issues/975#issuecomment-718199059 you must look at the Safari Web Inspector (and make sure you refresh the webview to see errors occurring on startup) to get more insights on what is actually happening in the application.

Throughout this thread, there are several comments of different possibilities and some suggestions on how to address specific issues.

pratikgohil1985 commented 3 years ago

issue was resolved after adding the "cordova-plugin-wkwebview-file-xhr" plugin