Re: assign property behaves differently from simple instance variable???
Re: assign property behaves differently from simple instance variable???
- Subject: Re: assign property behaves differently from simple instance variable???
- From: Ricky Sharp <email@hidden>
- Date: Mon, 13 Dec 2010 15:45:15 -0600
On Dec 13, 2010, at 1:31 PM, Wim Lewis wrote:
>
> On 13 Dec 2010, at 11:01 AM, Matt Neuburg wrote:
>> How can this seemingly minor change make such a big difference? I'm not even *using* the synthesized accessor! Yet its mere presence breaks the project. How can this be? m.
>>
>> PS A new discovery: changing the name of the ivar / property to "fr" solves the problem. So it appears that the problem is that I'm synthesizing accessors for the *name* "firstResponder". It is as if this name was being used under the hood in some way I'm unaware of, and synthesizing an accessor breaks its use. But how can *that* be?
>
> Perhaps it stomps on the -isFirstResponder method? KVC access for 'foo' checks (among other things) '-isFoo', presumably so that boolean properties feel natural; perhaps synthesizing a 'foo' property likewise causes the object to respond to 'isFoo'.
>
> Hmm, also, it appears that UIResponder has some undocumented methods -firstResponder and -_firstResponder, which your synthesized property would also interfere with.
A collision is most likely the case here. That is why several years ago I adopted a coding practice of ensuring all my methods, keys, properties, etc. are completely unique. For the specific case of properties and methods, I do this:
BOOL firstResponder_II;
- (BOOL)firstResponder_II;
- (void)someMethod_II:(int)anInt with:(int)foo multiple:(int)bar parameters:(int)baz;
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
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