Exceptions to the "don't use -[NSManagedObject dealloc]" rule?
Exceptions to the "don't use -[NSManagedObject dealloc]" rule?
- Subject: Exceptions to the "don't use -[NSManagedObject dealloc]" rule?
- From: Jonathan del Strother <email@hidden>
- Date: Thu, 30 Sep 2010 14:41:08 +0100
Hi,
I'm in the process of converting an existing iPhone app to use Core
Data for its backend storage. I've got a model that manages an upload
of its own attributes to a server - it has a retained NSURLConnection
instance variable. Traditionally, I'd just release the connection in
the model's dealloc method. Core Data seems to suggest that if I do
that, my connection will never get released, since dealloc won't get
called, and I should do everything in didTurnIntoFault method.
However, even if my model refaults while a connection is in progress,
the connection ought to carry on uploading. After the connection has
uploading, it doesn't actually need the model's attributes, so won't
trigger a new fetch. So where am I supposed to release the
connection?
Or is it that in practice, live Core Data objects that are being
retained by a controller never get refaulted? There's only a brief
mention of refaulting (in the Core Data glossary), and not much
explanation of when it might happen. I assumed that on the iPhone in
particular, a memory warning might trigger live objects into
transparently becoming fault objects, but I've not actually seen much
written evidence to back that up.
-Jonathan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden