I have a controller with a delegate.
@interface MyConversionController : NSObject {
id <ConversionDelegate> _delegate;
}
@property (assign) id delegate;
@end
@implementation
@synthesize delegate = _delegate;
@end
I'm getting Unrecognized selector sent to instance 0x36c4a0
errors. I've set a breakpoint on the -(void)setDelegate(id)delegate
method so I can observe objects that are passed into my MyConversionController
class. My setDelegate
method is called twice, the first time is an object at the address 0x36c4a0
that I know conforms to the <ConversionDelegate>
protocol. The second time this method is called another object is passed in that also conforms to the protocol. When the time comes to start calling methods on the delegate the method calls are sent to the first object (0x36c4a0
) which is now some other kind of object (usually a CFString
or __NSFastEnumerationEnumerator
if that makes a difference).
Does anyone know why this could be happening?
After running malloc_history
I see that the first address, the one that's giving me trouble, is allocated and freed a number of times before I get to it. The second object is just allocated once. Under what conditions would the pointers be reused like this?