0

I am facing one of the strangest problem.My ionic v1 app works fine in android and iphone but it is not working properly in ipad. My app has four tabs one of the tab is home which loads 'home' view to which 'HomeController' is binded, but somehow this controller fails to load while app running in ipad i.e angularjs is unable to find the 'HomeController'.

Below is the Xcode log screenshot displaying "HomeController" error.

Xcode log while testing app on ipad

As we can see in the above Xcode log screenshot angularjs is unable to find and load "HomeController".

i have also checked for any case error in name while including "HomeController.js" file in index.html that is also correct.Also i have checked for any Dependency injection error but everything is right if it was not then app would not run on any device.

Below is configuration information-

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : 7.0.1
Gulp CLI    : not installed globally

local packages:

Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework   : ionic1 1.3.1

System:

Node  : v6.11.2
npm   : 3.10.10
OS    : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b

Ipad's ios version:-9.3.5

Thank You.

  • Check the filename. sometimes the Uppercase and lowercase characters in filename makes this kind of issues. – Mithun Sen Sep 01 '17 at 09:36
  • Thank you @MithunSen for replying as i already mentioned in question, i have checked for case error in filename and for any DI error in angularjs but that is not the case. if there were any errors then the app wont work on any other devices. – nitin sachdev Sep 01 '17 at 10:07

1 Answers1

1

After so much googling and debugging, finally i found the problem. the main problem was that i was using 'let' to declare variable in 'strict mode' and i was unable to see the problem because lack of xcode to show verbose log.

so to display appropriate error message i placed below code in index.html before loading any javascript files.

index.html

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

i specially thank karma for the above code in this answer