views:

45

answers:

2

so i have a program i am developing and as im fairly new to objective-c and cocoa touch im not very familiar with the concepts of memory management in ipad app development. my problem is that my program keeps crashing without any warning and without telling me why, i turned on breakpoints and it shows an exc_bad_access signal. which leads me to believe that im not handling the memory properly. or its something else that i've over looked in my efforts. either way i need some help. if anyone can take a look at the app and tell me anything that may be causing it to act the way it is that would be great.

the point of the program is that it shows 20 mayan glyphs of the numbers 0-19, you drag the glyphs one at a time into the white 'drop zones' and it adds them and displays the result. however almost every time as soon as the second glyph is dropped in it quits, or it will display the answer and when you remove one of the glyphs to add another set it will quit then.

any help would be greatly appreciated. thanks stackoverflow :)

source files here

+2  A: 

Hi, why don't you read Apple's documentation, which is reasonably excellent on this particular topic?

http://developer.apple.com/iphone/library/documentation/cocoa/conceptual/memorymgmt/memorymgmt.html

chpwn
+1  A: 

Get to know the debugger. At the point at which you see the EXC_BAD_ACCESS and the program halts, look at the call stack to actually see what the source of the signal was.

Also, in the case of an issue with accessing an object that has already been deallocated, it's useful to have NSZombieEnabled set to YES in your environment variables. To do that open the info panel for your executable (Groups & Files pane, expand 'Executables', and open the info panel for the executable your project builds) and in the "Arguments" add an environment variable named NSZombieEnabled with the value YES. With this enabled any objects which are deallocated are actually turned into an instance of a 'zombie' class which will allow you to catch any messages sent to those instances.

imaginaryboy