ionic-team / ionic-v3

The repo for Ionic 3.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
127 stars 86 forks source link

App crashes on splash screen while opening #724

Open ionitron-bot[bot] opened 5 years ago

ionitron-bot[bot] commented 5 years ago

Original issue by @nikotrall on 2018-10-21T10:18:18Z

Bug Report

Ionic Info

Ionic:

   ionic (Ionic CLI)          : 4.1.2
   Ionic Framework            : @ionic/angular 4.0.0-beta.7
   @angular-devkit/core       : 0.7.5
   @angular-devkit/schematics : 0.7.5
   @angular/cli               : 6.1.5
   @ionic/ng-toolkit          : 1.0.7
   @ionic/schematics-angular  : 1.0.5

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic 5.2.5, cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.2.0, (and 10 other plugins)

System:

   ios-deploy : 2.0.0
   NodeJS     : v8.11.1 (/Users/A2/.nvm/versions/node/v8.11.1/bin/node)
   npm        : 6.2.0
   OS         : macOS
   Xcode      : Xcode 10.0 Build version 10A255

Describe the Bug When I build app in Xcode and then launch it on emulator/device it loads fine, but when I do the same and app is already installed on emulator/device it won't load, it gets stuck on splash screen with error:

ERROR: Unhandled Promise rejection: cancelled ; Zone: <root> ; Task: Promise.then ; Value: TypeError: cancelled

I made sure that I'm handling all the errors, and still there is unhandled promise, so I guess it occurs somewhere inside cordova/ionic

Steps to Reproduce Steps to reproduce the behavior:

  1. Build app using command ionic cordova build ios
  2. If app was built on emulator/device before, build and launch it Xcode (cmd + shift + U, cmd + R)
  3. Wait a bit, and then scroll to the bottom of Xcode console, you will see an error, that I attached above

Expected Behavior App should be loaded successfully after reopening.

Thank you in advance

tallcoder commented 5 years ago

This is happening to me too, on a project that was running/building fine. But, to be fair, I've hit this before and I can't seem to remember what I did to fix it.

JonathanFSteele commented 5 years ago

Same Issue, does Anyone have any fixes yet. I Would try to run:

ionic cordova run ios --livereload

and the weird thing is that it would actually work initially for the first time, but if you update the code the live refreshes reloads the app it shows a white screen and gives me the same error.

image image

Any help towards the fixing of this bug would be much appreciated.

aintnomoreloyalty commented 5 years ago

Hi @JonathanFSteele , I figured out what the issue was It was caused by Google Analytics, so when I removed it from my project, it started working well. Please try it

JonathanFSteele commented 5 years ago

Hey @nikotrall, thanks for the quick response.

So Google Analytics, Is that an npm package off of the package.json or in the node modules? As I searched through my project and couldn't find any such references.

Here is my Ionic Info for this project:

$ ionic info
[ERROR] Error loading @ionic/schematics-angular package.json: Error: Cannot find module
        '@ionic/schematics-angular/package'
[ERROR] Error loading @ionic/ng-toolkit package.json: Error: Cannot find module '@ionic/ng-toolkit/package'
✔ Gathering environment info - done!

Ionic:

   ionic (Ionic CLI)          : 4.2.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-rc.1
   @angular-devkit/core       : 7.1.4
   @angular-devkit/schematics : 7.1.4
   @angular/cli               : 7.1.4
   @ionic/ng-toolkit          : not installed
   @ionic/schematics-angular  : not installed

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic 5.2.7, cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 6 other plugins)

System:

   ios-deploy : 2.0.0
   NodeJS     : v10.10.0 (/usr/local/Cellar/node/8.9.2/bin/node)
   npm        : 6.4.1
   OS         : macOS High Sierra
   Xcode      : Xcode 9.4.1 Build version 9F2000

Any advice or help would be much appreciated.

aintnomoreloyalty commented 5 years ago

@JonathanFSteele could you please show me your package.json ?

JonathanFSteele commented 5 years ago

Here is my current package.json:

{
  "name": "app",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~7.1.4",
    "@angular/core": "~7.1.4",
    "@angular/forms": "~7.1.4",
    "@angular/http": "~7.1.4",
    "@angular/platform-browser": "~7.1.4",
    "@angular/platform-browser-dynamic": "~7.1.4",
    "@angular/router": "~7.1.4",
    "@ionic-native/core": "5.0.0-beta.21",
    "@ionic-native/splash-screen": "5.0.0-beta.21",
    "@ionic-native/status-bar": "5.0.0-beta.21",
    "@ionic/angular": "4.0.0-rc.1",
    "@ionic/pro": "2.0.4",
    "core-js": "^2.5.4",
    "rxjs": "~6.3.3",
    "zone.js": "~0.8.26",
    "moment": "^2.23.0",
    "mtime-common": "1.1.0"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.11.4",
    "@angular-devkit/build-angular": "~0.11.4",
    "@angular-devkit/core": "~7.1.4",
    "@angular-devkit/schematics": "~7.1.4",
    "@angular/cli": "~7.1.4",
    "@angular/compiler": "~7.1.4",
    "@angular/compiler-cli": "~7.1.4",
    "@angular/language-service": "~7.1.4",
    "@ionic/angular-toolkit": "~1.2.0",
    "@types/node": "~10.12.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.4",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.12.0",
    "typescript": "~3.1.6"
  },
  "description": "An Ionic project"
}
aintnomoreloyalty commented 5 years ago

Okay, my advice to you is: If you are using VSCode, try "Find in folder" option in your node_modules folder. Try search this: 'cancelled'

That is all I can help you with searching for a package that is breaking you app

JonathanFSteele commented 5 years ago

@nikotrall thanks for the advice, I will keep looking into this issue and If I find a solution I will post it on this forum.

Current Progress Update: So when searching for "canceled" in the node-modules a lot of results popped up, of course, I then narrowed it down to "cancelled" & "zone" & "Task", and I came across the zone-mix, zone-node, zone-testing-bundle, zone-testing-node-bundle, and zone.js Node Packages.

I was able to find the line that is displaying the error message shown above.

I tried deleting the entire node-modules folder and ran an npm install again to see if the local packages were incorrect in any way, but I ran into the same issue.

Any suggestions? Are there any issues with the current version of zone.js that I have currently perhaps?

aintnomoreloyalty commented 5 years ago

@JonathanFSteele let me think. Do you face that issue only running on device ? Or you can see it by watching app in browser running ionic serve command ?

JonathanFSteele commented 5 years ago

@nikotrall it seems to be only when you try to run ionic cordova run ios --livereload or ionic cordova run android --livereload, When you just ng serve it, and make a change it seems to work just fine. Also the current Ionic Build I pushed up to the Ionic Pro Dashboard seems to build it just fine with it working on my iPhone as well. So it might be just an issue with the cordova run command perhaps?

aintnomoreloyalty commented 5 years ago

@JonathanFSteele that is possible too I am sorry that I couldn't help you, it's a big challenge to debug kind of this error

JonathanFSteele commented 5 years ago

@nikotrall So on a side note I created a brand new app and did a npm install and the Cordova command works perfectly fine, So I deleted the node-modules folder and package-lock json file from my project and updated the package.json and config.xml where they are practically the same. Then I did a npm install for my project. tried out the ionic cordova run ios --livereload and it works the first initial time and then gets the same error when making a change and it reloads; This is strange as even for the brand new app it works perfectly fine the only big differences are that I have momentjs, a Custom Angular Library, and 2 pages with working functionality with calls to an api. strange.