Reputation: 608
When I create the model objects for my entity in CoreData in ARC mode, it generates retain instead or strong. So does retain work and compiles in ARC mode also? I thought in ARC mode we cannot use release, autorelease and retain keywords?
Upvotes: 10
Views: 2337
Reputation: 23359
Please check out this answer: https://stackoverflow.com/a/10036821/662605
The gist of it is that if you @synthesize
your properties, then the code generated under the hood will rely on the retain
type (retain
, assign
, copy
).
Generated Managed Object subclasses use @dynamic
not @synthesize
, all this stuff is happening magically for you, so actually, although it's confusing, the retain
keyword isn't being used it would seem, therefore the ARC isn't complaining... I'm pretty sure that's it.
Although I did try to swap the implementation to use @synthesize
and still didn't get errors, but I think we could be onto something with that answer on the link
Any other insights would be nice.
Upvotes: 4
Reputation: 385500
Do you mean that it generates a @property
declaration like this?
@property (nonatomic, retain) MyObject *object;
The retain
property attribute means strong
under ARC.
Upvotes: 4