How can I find out why my app running in simulator abruptly crashes

109 Views Asked by At

I'm using ruby motion. Below are the details of my environment.

$ motion --version
2.9
$ bundle
Using bubble-wrap (1.4.0) 
Using motion-require (0.0.7) 
Using formotion (1.6) 
Using motion-layout (0.0.1) 
Using thor (0.18.1) 
Using rubymotion_generators (0.1.0) 
Using bundler (1.3.5) 

When I run my app and click a button that is suppose to load a form built with formation, my app abruptly crashes with this error message.

* Simulator session ended with error: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 "The simulated application quit." UserInfo=0x10011e200 {NSLocalizedDescription=The simulated application quit., DTiPhoneSimulatorUnderlyingErrorCodeKey=-1}

Running with rake debug=1 I see the following:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xc7243c89
0x0081309f in objc_msgSend ()
(gdb) 

My app was working perfectly fine before upgrading rubymotion and once I updated rubymotion I had to update some of my gems as well.

How can I resolve this or troubleshoot this?

2

There are 2 best solutions below

0
Jamon Holmgren On

This is almost always when you're trying to access an object that has been deallocated. Try changing your variable to an instance variable (@myvar) or a global ($myvar) and see if that fixes the issue. Obviously, you don't want to use a global in production, but give it a shot.

0
Steve Ross On

The first thing to do when you hit that breakpoint is to get your backtrace. Often this will point you in the right direction. Another way to see the information is open a console, then run/crash your app. See what's going on.

As @Jamon says, it's typically something that has been reaped by the GC when you didn't expect it to be.