PDA

View Full Version : Really Need some Debugging Tips!!! App crashes Device but not Simulator!




belsokar
Jul 29, 2008, 07:48 PM
I'm a developer (.Net, Java) but I'm a new Iphone/Touch developer, I'm writing an app that currently uses a couple table view controllers, navigation controller, a sqlite3 database for storing some reference data.

Up until about a day ago, my application was running great both in the simulator, and on my device,...I haven't made any major changes really, but all of the sudden, it crashes only on my device, with the following error:

Program received signal: "EXC_BAD_ACCESS"


It works as expected in the simulator however which is why I haven't been able to really pin it to a particular new line of code or anything.

Unfortunately, it's not like it's crashing on a single line of code so I can step through the debugger and pinpoint the exact cause of failure. When it fails, I get the above error, and the debugger is breaking somewhere in the assembly/machine code.

Anyways, I'd love some tips, pointers, good reference articles on this particular issue, as well as maybe general best tips for debugging applications both within the simulator and on my device. I'm not looking for anyone to solve my problems really, but just trying to learn more about XCode and the whole debugging environment...and if you have insight into this particular issue, that would be great too! :)



firewood
Jul 29, 2008, 09:25 PM
These types of crashes are often due to memory management or pointer issues. You might want to carefully check, or put in assert code to watch, all pointer and object usage to make sure they're valid, and not null, out of bounds, or referencing deallocated or moved memory blocks.

Also double check all error return values. Some features aren't supported on the hardware.

The third thing to check is for timing issues. There can be a big difference in performance between the two platforms. Check for race or deadlock conditions with any locks or threads or timer tasks that can happen in a completely unexpected order and cause your handlers to go off into the weeds.

detz
Jul 29, 2008, 09:37 PM
Check out Instruments, this should give you a quick idea of what's going on during run-time and even help you replicate the issue for testing.