Re: [iPhone] OS 3.0 and @synthesize AND @dynamic for the same property
Re: [iPhone] OS 3.0 and @synthesize AND @dynamic for the same property
- Subject: Re: [iPhone] OS 3.0 and @synthesize AND @dynamic for the same property
- From: Roland King <email@hidden>
- Date: Sat, 14 Nov 2009 15:05:38 +0800
take the @dynamic out.
Since you are synthesizing the property you don't need the @dynamic which suppresses the warning that you haven't defined the setter or the getter.
You use the @dynamic statement to tell the compiler to suppress a warning if it can’t find an implementation of accessor methods specified by an @property declaration.
On 12-Nov-2009, at 5:52 PM, Joerg Simon wrote:
> Dear all other Cocoa Developers:
>
> In an app I am developing I have the following strange thing:
>
> [code in the .h file]
> @interface XY : CALayer
> BOOL _editing;
> ...
> @property (assign, getter = isEditing) BOOL editing;
>
> [/code]
>
> [code in the .m file]
> @synthesize editing = _editing;
> @dynamic editing;
> ....
> [/code]
> I get: error: property 'editing' is already implemented
>
> So, this code now compiles:
> Fine for all versions of OSes under leopart
> Only for versions 2.x under snow leopard.
>
> Since my laptop runs snow leopard, and I am very often developing on my laptop, and snow leopard lacks a OS 2.x iPhone simulator, that means I can't use the simulator on the iPhone, and it secondly means that the app has problems to compile with the new compiler, and that would be bad if apple switches internally.
>
> Any suggestions what to do?
>
> Thanks,
> Joerg Simon
> _______________________________________________
>
> 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
_______________________________________________
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