XCode 6.3 Warning: synthesize property
XcodeDynamicWarningsXcode Problem Overview
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?
Xcode Solutions
Solution 1 - Xcode
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 2 - Xcode
I simply removed this property declaration, because it has already been declared in parent class
Solution 3 - Xcode
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 - Xcode
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 - Xcode
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;
Solution 6 - Xcode
If you updated to Xcode 6.3, simply update AFNetworking to version 2.5.2 and these warnings should disappear.
Solution 7 - Xcode
@implementation Myclass
@synthesize homeInt = _ homeInt; ...
@end