Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App converted to ARC, now getting warnings about my properties

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?

like image 760
Nic Hubbard Avatar asked Mar 07 '12 20:03

Nic Hubbard


2 Answers

Sorry to add a second answer, but this turns out to be more intricate than I thought. It turns out that you're seeing a changed behavior (perhaps a bug?) in Xcode 4.3.

In Xcode 4.2, the converter would have offered to change (nonatomic, retain) to (nonatomic, strong). But in Xcode 4.3, it offers to change it to (nonatomic); I guess if you don't want that, changing retain to strong is up to you before converting.

On the other hand, in Xcode 4.2, (nonatomic) alone was absolutely illegal for a synthesized property; in Xcode 4.3, it is not: you get a warning, but it assumes you mean assign and so it isn't illegal.

So there's been a change in how ARC works in LLVM 3.1 and an accompanying change in the Xcode 4.3 ARC converter.

like image 95
matt Avatar answered Nov 16 '22 00:11

matt


I think the answers are wrong.

In Xcode 4.3 you get a warning. However, it assumes you mean RETAIN. Retain is the new default for codes under ARC. Someone told me that xcode is fixing this.

Please correct me if I am wrong.

like image 22
user4951 Avatar answered Nov 16 '22 00:11

user4951