Re: Custom Delegate - Using _delegate works but not delegate or [self delegate]
Re: Custom Delegate - Using _delegate works but not delegate or [self delegate]
- Subject: Re: Custom Delegate - Using _delegate works but not delegate or [self delegate]
- From: Chris Tracewell <email@hidden>
- Date: Mon, 25 Mar 2013 16:06:40 -0700
On Mar 25, 2013, at 1:54 PM, Conrad Shultz <email@hidden> wrote:
> "[self delegate]" is not the same as "delegate" - the former sends the -delegate message, the latter references a variable named "delegate" (which the compiler is telling you does not exist).
I assumed that since my subclass inherits from NSOutlineView which already has a delegate instance method that a delegate ivar already existed? Since this is occuring while converting to ARC could it be that _delegate is working because modern Objective-c adds the underscore to the front of ivars during synth? Still though, I do not understand why [self delegate] will not work.
this must be that my delegate declarations are incorrect.
> For example, here you correctly use "[self delegate]" in the if() condition but improperly fall back to merely "delegate" for actually dispatching your delegate message.
I had replaced [self delegate] with "delegate" while troubleshooting, but both trigger the error. I am transitioning to ARC, [self delegate] was working compiling in XCode 3.2 for 10.6.8.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden