• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Copying Managed Objects from App to Doc MOContext
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copying Managed Objects from App to Doc MOContext


  • Subject: Re: Copying Managed Objects from App to Doc MOContext
  • From: "Kyle Sluder" <email@hidden>
  • Date: Sat, 20 Dec 2008 23:21:04 -0500

On Sat, Dec 20, 2008 at 9:29 PM, Jerry Krinock <email@hidden> wrote:
> Both.  The app-wide MOC has its PSC set to the app-wide PSC, which in turn
> has a persistent store in the Application Support folder.

OK, good, glad I understood you there.

> By UUID, I believe you mean [[[self objectID] URIRepresentation]
> absoluteString].

Yes.

> I'd considered that, but since it's possible that the source potato in the
> central store might go away, indeed I want a copy.  I was thinking that, for
> portability and robustness, in most cases one would not want a document to
> reference an object in an app's Application Support.

This is a situation you will need to handle anyway when you're dealing
with multiple MOCs, since they don't notify each other of changes.  If
you are cloning your prototypical potatoes simply because you're
afraid of them disappearing in your app's PSC, then I recommend you
look into Fetched Properties:
http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CoreData/Articles/cdRelationships.html#//apple_ref/doc/uid/TP40001857-SW7
.

Again, you need to determine if your app's semantics really do require
you to clone your prototypes.  In most apps, for example, if you
create a new document based on a template and then change the template
the document doesn't get changed.  If that's the behavior your app
needs, then keep doing what you're doing.  Otherwise, look into
modeling a cross-store relationship.  You could perhaps store a
"referencedByCount" attribute in your global objects, and ensure that
objects don't get deleted unless this attribute is zero.

--Kyle Sluder

>
> Thank you, Kyle -- I'm starting to see a clearer picture what I'm doing now.
>
> _______________________________________________
>
> 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
>
_______________________________________________

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

References: 
 >Copying Managed Objects from App to Doc MOContext (From: Jerry Krinock <email@hidden>)
 >Re: Copying Managed Objects from App to Doc MOContext (From: "Kyle Sluder" <email@hidden>)
 >Re: Copying Managed Objects from App to Doc MOContext (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: selectionShouldChangeInTableView called twice
  • Next by Date: Re: Using runtime functions to match up object types safely when setting properties
  • Previous by thread: Re: Copying Managed Objects from App to Doc MOContext
  • Next by thread: re: Copying Managed Objects from App to Doc MOContext
  • Index(es):
    • Date
    • Thread