XCode 6.3 Warning: synthesize property

XcodeDynamicWarnings

Xcode 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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionUnRewaView Question on Stackoverflow
Solution 1 - XcodeKarmeyeView Answer on Stackoverflow
Solution 2 - XcodestasickView Answer on Stackoverflow
Solution 3 - XcodeChris PrinceView Answer on Stackoverflow
Solution 4 - XcodemplaceView Answer on Stackoverflow
Solution 5 - XcodezmingchunView Answer on Stackoverflow
Solution 6 - XcodeMarcos ReboucasView Answer on Stackoverflow
Solution 7 - XcodeBrandonYumView Answer on Stackoverflow