views:

47

answers:

2

I currently have three modalViewControllers and each have their own ways to dismiss.

For Two of them, I have to use UILabel and then have using the touchesEnded: method to determine whether the release was within the proper area - then call to dismiss the modalViewController.

However, I have one where I can just use a UIButton and it works fine.

I just can't figure out why the heck I can't use a UIButton for all of them. I keep getting the error:

objc[38738]: FREED(id): message release sent to freed object=0x5214f70
Program received signal:  “EXC_BAD_INSTRUCTION”.

I'm assuming it has to do with attempting to access something that has been released (duh) - but I don't have anything occurring other than a -(IBAction)closeWindow:(id)sender {} method that calls:

[self dismissModalViewControllerAnimated:YES];

Any help?

+1  A: 

You should try running with the zombies instrument to see where you are messaging a freed object. From Xcode just go to Run->Run with Performance Tool->Zombies and that will launch Instruments with the correct setup.

You are probably either releasing (or autoreleasing) an object you shouldn't (because you don't own it) or are failing to retain something that you should. Instruments will help you find out where.

Jason Foreman
Excellent, now that I know what the problem is, I'll leave it in and test out the Zombies tool. Thanks.
Smokin Joe
A: 

In case people are curious as to how this is working out - I discovered my problem:

I was releasing an object that I had not retained.

Here's my journey to success: http://www.iphonedevsdk.com/forum/iphone-sdk-development/52946-why-can-i-not-use-uibutton-dismiss-modalviewcontroller-consistently.html

Smokin Joe