ARC and the singleton store object


I’m trying to set up CoreData with the homeowner project of the book but i can’t manage to work the best way to implement the PossesionStore with ARC.
What is the best way to do this ?


Hey NewNerd,

I haven’t had any issues with combining ARC and a CoreData Singleton. Here’s what I did. I removed all the [object retain] and [object release] code inside the -init, +defaultStore:, and +allocWithZone: methods. ARC will handle all of that stuff for you. By default, when you instantiate a new object, the relationship is set to “strong” (which is pretty much like retain);

On top of that, I removed the following Instance Methods:

/* Don’t need these instance methods with Core Data.

  • (id)retain {return self;}
  • (id)release {return self;}
  • (id)retainCount {return NSUIntegerMax;}

Hope that helps.

  • Dave


It does help, thanks dave!