XCode 6.3 Warning: synthesize property
Solution 1
I simply removed this property declaration, because it has already been declared in parent class
Solution 2
If you are overriding the same property from the super class on purpose, then in your *.m
or *.mm
file, add @dynamic
like:
@implementation MyClass
@dynamic homeInt;
// ...
@end
If not, rename the property.
Solution 3
Following on @mplace's comment, in my case I was overriding the property to refine the type of the property to a subclass of the original class of the property. So, I did need the @property override.
Here's what I'm using:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-property-synthesis"
// superclass type for currentValue was "id"
@property (nonatomic, strong) NSDate *currentValue;
#pragma clang diagnostic pop
Note that it's "-Wobjc-property-synthesis" and not "-Wno-objc-property-synthesis"
See also https://github.com/couchbase/couchbase-lite-ios/issues/660
Solution 4
If you want to avoid adding @dynamic <varName>
each place that you have overridden a super class's property intentionally, you can add the -Wno-objc-property-synthesis
flag to "Other Warning Flags" under your projects build settings. This will suppress the warning project-wide.
Solution 5
this cause by child class define the same property name override to parent class,such as:
1)child class "AFHTTPSessionManager" have define :
@property (nonatomic, strong) AFHTTPResponseSerializer <AFURLResponseSerialization> * **responseSerializer**;
2)parent class "AFURLSessionManager" have define:
@property (nonatomic, strong) id <AFURLResponseSerialization> **responseSerializer**;
3)cause by above, warning come! if want remove it ,just rename the conflict property name!
4) or as it suggest, add "@dynamic homeInt" in your implement file;
Comments
-
UnRewa almost 3 years
In new Xcode 6.3 I get this warning:
Auto property synthesis will not synthesize property 'homeInt'; it will be implemented by its superclass, use @dynamic to acknowledge intention
How I can remove it?
-
Bradley Thomas about 9 yearsI see the same warnings for AFNetworking. Question is, are these anything to be concerned about? Do they even need attention for this library
-
zmingchun about 9 yearsit has fixed! github.com/AFNetworking/AFNetworking/commit/… @BradThomas
-
ecotax about 9 yearsThis is correct for warnings resulting from AFNetworking properties. The original question wasn't about one of those though.
-
AnthonyMDev about 9 yearsThis isn't suppressing the warnings for me... I'm using Cocoapods, not sure if that is overriding my flags.
-
Chris Prince about 9 years-Wno-objc-property-synthesis does not work for me either to suppress this warning. Any one else have ideas?
-
Chris Prince about 9 yearsLet me refine that. It doesn't work when I put it inline with the code with "#pragma clang diagnostic ignored", but it does work when I put it with the compiler flags. I'd rather not make it general across all my code with the compiler flags...
-
hyperspasm about 9 yearsI'm glad I'm not the only one who accidentally ends sentences with a semicolon;
-
talentlife over 5 years@dynamic is better