Ionic novice debugging a previously functioning app that just stopped working

Hi all. I am working on an app that I did not originally develop to solve a few minor run-time bugs since the original developer has moved on. Unfortunately, the disorganization of the project has gotten the best of me. I started the project about 5 months ago, got my dev environment running, successfully built and ran the app, and applied the fix. My testing went fine, but after months of back and forth (a wild goose chase for the original release keys, testers who didn’t test anything, app store woes, the list goes on), I got feedback that the iOS app would run but just hang at the first screen that takes user input and uses it to download some info from a database. This failure occurred after I rebuilt and released the app to TestFlight a few weeks ago; no code changes were made at that time. Upon further review, I’m now getting the following error on Android (I don’t have an iOS device handy for testing but it hangs at the same spot). I’m a bit stuck.

11-15 01:12:19.683 23165-23165/com.rhelper.rhelperapp D/SystemWebChromeClient: file:///android_asset/www/lib/ionic/js/ionic.bundle.js: Line 21157 : ReferenceError: Connection is not defined
at Object.isOnline (file:///android_asset/www/js/ng-cordova.min.js:9:2926)
at new (file:///android_asset/www/js/controllers/main.js:14:40)
at invoke (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13277:17)
at Object.instantiate (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13285:27)
at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17841:28
at Object.self.appendViewElement (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:52255:24)
at Object.render (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:50449:41)
at Object.init (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:50369:20)
at Object.self.render (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:52115:14)
at Object.self.register (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:52073:10)
11-15 01:12:19.683 23165-23165/com.rhelper.rhelperapp I/chromium: [INFO:CONSOLE(21157)] “ReferenceError: Connection is not defined
at Object.isOnline (file:///android_asset/www/js/ng-cordova.min.js:9:2926)
at new (file:///android_asset/www/js/controllers/main.js:14:40)
at invoke (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13277:17)
at Object.instantiate (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:13285:27)
at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:17841:28
at Object.self.appendViewElement (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:52255:24)
at Object.render (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:50449:41)
at Object.init (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:50369:20)
at Object.self.render (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:52115:14)
at Object.self.register (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:52073:10)”, source: file:///android_asset/www/lib/ionic/js/ionic.bundle.js (21157)
11-15 01:12:19.755 23165-23165/com.rhelper.rhelperapp W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 23165

Main.js appears as follows:

‘use strict’;

angular.module(‘rhelper’)

.controller('MainCtrl', function($scope, $state, $rootScope, $window, $ionicPopup,localStorageService, $ionicLoading, $cordovaNetwork, $cordovaSQLite) {
    $scope.pMode = localStorageService.get("parentMode");
    console.log($scope.pMode);
    $scope.data = {
        "points":0
    };
    var type = $cordovaNetwork.getNetwork();
    var isOnline = $cordovaNetwork.isOnline();

at ‘var isOnline…’ it fails. I tried doing a device readiness check beforehand but it didn’t seem to fix anything. I’m wondering if there is some conflict between the version of Ionic, Cordova, or ngCordova that was originally used to build the app and what I have now. Since I’m not that familiar with these frameworks, I’m not really sure where to start. Any thoughts would be appreciated. I’m more of a C/Java/embedded/server-side developer, so I’m less familiar with debugging in a web front-end context.

Current dev environment info:

  • Cordova CLI: 6.4.0
  • Ionic CLI Version: 2.1.8
  • Ionic App Lib Version: 2.1.4
  • ios-deploy version: 1.9.0
  • ios-sim version: 5.0.11
  • OS: OS X El Capitan
  • Node Version: v6.9.1
  • Xcode version: Xcode 7.3.1 Build version 7D1014
  • Bower version: 1.8.0

Hey,

Just wondering if you had any joy getting this sorted? Having a similar problem with an app that was working perfectly up until the end of last week with no code changes and now getting the same error as yours. Have you any words of wisdom to pass on? :slight_smile:

This being a main controller, I suppose you should wrap it in deviceready event like
document.addEventListener(“deviceready”, function () {
//your code
}