-->

ionic 1, app won't start in iOS 9.3, white scr

2019-08-11 09:20发布

问题:

>ionic info

Node       : v6.7.0
OS         : macOS Sierra
Xcode      : Xcode 8.3.3 Build version 8E3004b 
ios-deploy : 1.9.1 
ios-sim    : 6.0.0 
npm        : 5.0.1 
@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.1 
Gulp CLI         : CLI version 3.9.1 Local version 3.9.1
Ionic CLI        : 3.4.0
@ionic/cli-plugin-cordova : 1.4.0
@ionic/cli-plugin-gulp    : 1.0.1
@ionic/cli-plugin-ionic1  : 2.0.0
Cordova Platforms         : android 6.0.0 ios 4.3.0
Ionic Framework           : unknown

>ionic cordova platform list

android 6.0.0
ios 4.3.0

App works normal for simulators with ios 10.3.x but when run on ios 9.3, it briefly shows splashscreen after that white blank page. There is no error messages on debug window, I see cordova ready and fcm and other plugin ready messages, but nothing from app source code...

What things I have tried

  • tried to different settings for whitelist plugin thought it might be blocking thread, no luck
  • tried removing platform and added different cordova platform add ios@x versions, no luck
  • have console.log in scripts, but they won't start or show up, no luck (maybe something is not allowing them to be loaded, but it works ios 10.x versions)

If anyone had or fixed white screen issue, please comment and share your solution, I am sure it would help a lot of people in future and especially me, for last few days tried every combinations, I can think of but nothing seem to help.

回答1:

For future, trouble makers, like myself :)

Above issue might be because of JS incompatibility or missing module dependencies, etc.

After many long hours of tries, I ended up finding a bug by adding following before injecting all other scripts inside <head> in index.html file.

<script type="text/javascript">
    window.onerror = function (errorMsg, url, lineNumber) {
      alert('Error: ' + errorMsg + ' Script: ' + url + ' Line: ' + lineNumber);
    }
</script>