I was converting a code from non-ARC to ARC, and removing some unnecessary @synthesize calls. One specific class started issuing warnings for some properties:
Class.h
@property (strong, nonatomic) NSString *xyz;
but when building, I get the warning.
Property 'xyz' requires method 'xyz'to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation
I thought that using Xcode 4.6 and and Default Apple LLVM compiler 4.2, the @properties should be auto-synthesized.
How do I tell the compiler to auto-synthesize the property? Do I have to use a specific project configuration to remove this warning?
If you declare an object/variable using @property, then that object/variable will be accessible to other classes importing its class. If you declare an object using @property in the header file, then you have to synthesize it using @synthesize in the implementation file.
Is this property on an NSManagedObject
subclass? NSManagedObject
disables auto-synthesis precisely because most declared properties are expected to be @dynamic
.
This is accomplished with the NS_REQUIRES_PROPERTY_DEFINITIONS
macro placed right before the @interface NSManagedObject
, which expands to __attribute__((objc_requires_property_definitions))
. This could be used on other classes too, but NSManagedObject
is the only framework class I know of that does this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With