How to debug an app when running on emulator?


#1

My app is working perfectly on Safari, Chrome and Firefox. When launched from the IOS emulator it fails to render a modal input field (built with an Angular directive). If I add the “-L” option to “ionic emulate ios” it render the input field but some functionality is not working properly. Is there a way to debug the IOS emulator?

EDIT:

Now I’m able to debug thx to this nice post How can I properly debug iOS on a simulator?
The ionic emulate -lc command line is working great I can see the errors the emulator is throwing.
Now I’m facing another issue :frowning:

Inside the directive I have this code:

scope.searchText = scope.suggestions[scope.selectedIndex].surname;

which is perfectly working on the browser but on the emulator I receive this error:

871769   error    Error: undefined is not an object (evaluating 'scope.suggestions[scope.selectedIndex].surname')
selectSuggestion@http://192.168.43.121:8100/js/appCtrl.js:416:82
$parseFunctionCall@http://192.168.43.121:8100/lib/ionic/js/ionic.bundle.js:21044:23
http://192.168.43.121:8100/lib/ionic/js/ionic.bundle.js:53458:21
$eval@http://192.168.43.121:8100/lib/ionic/js/ionic.bundle.js:23100:28
$apply@http://192.168.43.121:8100/lib/ionic/js/ionic.bundle.js:23199:28
http://192.168.43.121:8100/lib/ionic/js/ionic.bundle.js:53457:19
eventHandler@http://192.168.43.121:8100/lib/ionic/js/ionic.bundle.js:11713:25
dispatchEvent@[native code]
triggerMouseEvent@http://192.168.43.121:8100/lib/ionic/js/ionic.bundle.js:2863:20
tapClick@http://192.168.43.121:8100/lib/ionic/js/ionic.bundle.js:2852:20
tapTouchEnd@http://192.168.43.121:8100/lib/ionic/js/ionic.bundle.js:2975:13

#2

Same problem here. Having undefined is not an object error as well. Can’t figure out whats wrong.


#3

You guys should be able to inspect the emulator, the same way you could do with a real phone. Open a chrome browser, and visit chrome://inspect/#devices page :slight_smile: