[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Javascript errors in Ionic app deployed on ios

Posted on 2016-08-07
3
Medium Priority
?
73 Views
Last Modified: 2016-09-20
I am working on an Ionic app. When testing in the browser (on laptop), Chrome developer tools provide a great way to debug using console.log. It also shows Javascript errors in the browser console.

However, once the app is deployed on iPad (using xcode) the browser console is no longer visible. How can I see the statements printed using console.log and Javascript errors, if any.

Some actions in my Ionic app are not responding after the app is deployed on iPad. I think there might be some Javascript errors being thrown but I am not able to find what they are.
0
Comment
Question by:ank5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 59

Assisted Solution

by:Julian Hansen
Julian Hansen earned 1000 total points
ID: 41746822
The following might be of use

Firebug lite for Mobile you can find it here

https://getfirebug.com/firebuglite_mobile

Waterbug for Safari - you can get it on GitHub here

https://github.com/robotnic/waterbug

Another option is to build a debug window in your app that is activated by some internal state variable. I usually have a pull down pane that appears as a handle in the top right of the screen. Anything I want to see going on either on the server or in the console I log to that window using JavaScript. The presence of the handle is activated by a URL parameter or a server side variable.

You redefine your console.log function to send to a div like so
if (typeof console  != "undefined") {
  if (typeof console.log != 'undefined') {
  console.clog = console.log;
  }
  else {
  console.clog = function() {};
  }
}

console.log = function(d) {
  console.clog(d);
  $('#debug-pane ul').append($('<li/>').html(d).addClass('list-group-item'));
};
  
//console.error = console.debug = console.info =  console.log;

window.onerror = function(message, url, linenumber) {
  console.log("JavaScript error: " + message + " on line " +
    linenumber + " for " + url);
}

Open in new window


Here is a working sample demonstrating the concept.
0
 
LVL 1

Accepted Solution

by:
ank5 earned 1000 total points
ID: 41747608
Below post solved the problem -

http://phonegap-tips.com/articles/debugging-ios-phonegap-apps-with-safaris-web-inspector.html

I am now able to view console logs and Javascript errors in Safari console
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
While there are many new features for iOS 11, these are the five that can improve your digital lifestyle.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question