Re: Xcode 3.2.3: cannot pair a synthesized setter/getter with a user defined setter/getter
Re: Xcode 3.2.3: cannot pair a synthesized setter/getter with a user defined setter/getter
- Subject: Re: Xcode 3.2.3: cannot pair a synthesized setter/getter with a user defined setter/getter
- From: Jean-Daniel Dupas <email@hidden>
- Date: Fri, 18 Jun 2010 18:28:36 +0200
Le 18 juin 2010 à 18:21, Gerd Knops a écrit :
> I just installed Xcode 3.2.3, and now in my project compiled with LVM/Clang I get lots of these warnings (code builds and runs fine in previous Xcode/compiler versions):
>
> warning: writable atomic property 'someProperty' cannot pair a synthesized setter/getter with a user defined setter/getter
>
> This is in cases where I use @synthesize, but provide a custom getter and rely on @synthesize to produce the setter (or vica versa).
>
> So basically in the header I have:
>
> @property (retain) SomeClass *someProperty;
>
> and in the implementation:
>
> @synthesize someProperty;
> - (SomeClass *)someProperty {
>
> if(!someProperty)
> {
> someProperty=[[self createSomeProperty]retain];
> }
>
> return someProperty;
> }
> // No setter, let @synthesize provide it
>
> I get a warning for my custom getter.
>
> How can I code this to not get a warning? I really would like to avoid writing setters where I don't need a custom behavior.
>
> Thanks
>
> Gerd
by properly declaring the property as nonatomic (as it cannot be atomic if you override either the setter or the getter)
@property (nonatomic, retain) SomeClass *someProperty;
-- Jean-Daniel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden