I’m trying to create my own Custom Delegates in iOS 5.
In iOS 4, I usually used the ‘Assign’ property:
@property(nonatomic, assign) id<AnyProtocol> delegate;
Now, when I try to synthesize, I get the following error message:
error: Automatic Reference Counting Issue: Existing ivar 'delegate' for unsafe_unretained property 'delegate' must be __unsafe_unretained
Any ideas ?
This error is because under ARC ivars default to strong
What this error is telling you that you’ve declared a property with
__unsafe_unretained(assign) ownership, but by default ivar have__strongownership, so they can’t be in one. You canDefine the ivar to match your (assign) property declaration:
Define the property to match the ivar’s implicit
__strongownership:The three options shamelessly copied from user chrispix’s answer in this thread..Credit goes there