Ios – App converted to ARC, now getting warnings about the properties

automatic-ref-countingioswarningsxcode

I just converted my app to ARC, and while it builds fine, I get like 600 warnings, all pertaining to my properties. Such as:

Default property attribute 'assign' not appropriate for non-gc object

No 'assign', 'retain' or 'copy' attribute is specified – 'assign' is
assumed

Screenshot for warning

After Xcode converted my code, here is what my properties look like:

@property (nonatomic) EKEventStore *eventStore;
@property (nonatomic) EKCalendar *defaultCalendar;
@property (nonatomic) UIActionSheet *currentActionSheet;
@property (nonatomic) UILabel *noEventLabel;

Someone talked about needing to add strong to all of these. Is this the case? Did Xcode forget to add something?

Best Solution

ARC is right. You cannot have no memory-management qualifer; you must say assign, retain (or strong which is the same thing), or weak.

Previously, assign was the default. But that is probably not what you want, because is it is the worst possible option - it is an old-style non-ARC weak reference. You either want a smart ARC weak reference (goes to nil when the object goes out of existence) or a strong reference (memory-managed for you by ARC).

Related Question