1

I'm new to NSZombie but I have a problem with my app crashing with EXC_BAD_ACCESS. I'm having real trouble finding the object that is causing the problem. Looking online I followed instructions to enable zombie objects.

The problem I'm having has been reported by another person on that page. Enabling zombie objects stops the bad access error but gives me no information. Nothing is printed by NSLog. Is there somewhere else I should look, or am I doing something wrong? I don't really know my way round XCode or a Mac very well as I'm mainly a C# programmer.

Any help would be most welcome.

Community
  • 1
  • 1
Magpie
  • 6,983
  • 14
  • 51
  • 67
  • from what i know..Zombies works when instances who are deallocated are sent a message..your problem might be something else.. try NSString *Mystring = [[NSString alloc]init]; ..then put this line two times in the code. [Mystring release]; right after you alloc..see if you see the zombies message – Shubhank Jan 23 '12 at 13:23

2 Answers2

1

1) Run your app on Intruments.

2) In instruments, select Object allocations tool(automatically selected if you select leaks tool).

3)Click on the little "i" on top left, within the Allocations tool.

4) Select "Enable NSZombie detection".

5) Press the record button and let your app run.

6) Go through the execution of the app untill it crashes. As soon as there is a crash, you'd see a pop up saying that there was a EXC_BAD_ACCESS. Click on the little -> on the pop up to see the object that has turned into a zombie and the line of code responsible.

Sorry I am unable to upload a screenshot, as am at work.

Vin
  • 10,517
  • 10
  • 58
  • 71
  • Thanks for this but it doesn't help, there is no EXC_BAD_ACCESS when I Enable NSZombie detection. It only happens when Enable NSZombie detection is disabled. – Magpie Jan 23 '12 at 13:38
  • Did you try it with Instruments? You don't need to have the NSZombieEnabled environment flag in your project to find this on instruments. – Vin Jan 23 '12 at 14:01
  • yes when I run it in Instruments with "Enable NSZombie detection" selected from the allocations tool the app doesn't crash. Without it selected it does. – Magpie Jan 23 '12 at 15:26
  • hmmm.... did you try exception breakpoint to get the line in your code where the app crashes? – Vin Jan 23 '12 at 15:34
  • The crash has mysteriously gone away which doesn't fill me with confidence. Didn't know xcode had "exception breakpoints", cheers for that. Why on earth this is on by default I don't know! – Magpie Jan 23 '12 at 16:51
  • Good to know that the crash has gone. If you are still skeptical try a different device, maybe a 3Gs or an iPod touch and see if you are able to recreate the issue. As for the exception breakpoint, file a enhancement request with Apple:) – Vin Jan 23 '12 at 16:59
0

Expand your project Executable and right click on it. and click on GetInfo->Argument tag aat end of the window you see plus and minus sign button click on + sighn button and write

Name              Value
NSZombieEnabled   YES

then after execute your project and whenever crash your application click on run munu-> console you see there why your application crash. please try this may be this will help you.

Dipen Chudasama
  • 3,063
  • 21
  • 42