Received Iphone debug signal: "EXC_BAD_ACCESS"

My iphone application accidentally received this message. I know this is a memory issue issue. However, what is the best way to find which object leads to this problem. Here is what I tried

  • Use tool leak and object tracing. I did not see any help find out which object this is a Problem

    1. Put NSZombieEnabled = YES and CEO ... Didn't see any help

    2. Put NSLog everywhere, but EXE_BAD_ACCESS will just appear anywhere. in the debugger, just saw the code happened in the assembly. how to objc-msg send.

    3. Browse the code many times and read memory management and online research many times, many times. but not surprising.

Is there a complete solution to easily solve this problem. I am a previous Visual C ++ programmer, I have been managing memory over the years, and it is easy to debug and analyze in Visual C ++.

+1
debugging iphone
source share
6 answers

As Juan noted, the first stop is Debugger - what gives a debug window for stack tracing when the application crashes? You should be able to see the line in which it crashed ... you said in a comment on one answer that you saw how an accident occurs around the lines:

CGPDFDocumnetRef docA=CGPDFDocumentCreatWithURL(myurl); CGPDFDocumnetRef docB=CGPDFDocumentCreatWithURL(myurl); 

Are you really using the same URL object for both calls? Which line exactly?

It may be something around how you use CGPDFDocumentRef, you can find a sample code of how Apple uses them in the QuartzDemo project, the QuartzImageDrawing.m file (you can find a demo project from the developer's portal or built-in iPhone documentation with Xcode).

Xcode is actually quite powerful, but it is different from other IDEs.

0
source share

If you could not see any useful debugging information, I would suggest you find all the places where you are doing release . Most likely, you released something that did not need to be released. The code will help us track problems with you.

+2
source share

In addition to Erich's answer, I would like to add back. Start with the most recently added release and work from there.

I came across this and it turned out that I released an automatically selected object that was returned from the convenience method built into the Cocoa -Touch structure. My problem was described by Erich - I released this automatically released object. When the system tried to free it, the program issued an error that you describe.

Yours faithfully,
Frank

0
source share

The best way to find out what happens with xCode Debbuger is to give it a try.

0
source share

You will also receive a message when you do not pass enough parameters to the variable argument method. For example, having an NSLog statement as follows: NSLog (@ "Hello% @");

0
source share

To check what might be a mistake

Use NSZombieEnabled.

To activate the NSZombieEnabled object in your application:

Choose Project> Edit Active Executable to open the Information executable window. Click Arguments. Click the add (+) button in the "Variables to be set in the environment" section. Type NSZombieEnabled in the Name column and YES in the Value column. Make sure the checkbox for the NSZombieEnabled entry is selected.

found this on iPhoneSDK

0
source share

All Articles