I'd like to copy items between two different UIManagedDocument persistent 
stores. What is the proper way to do this?

Assuming I have a NSManagedObject subclass instance mo1 obtained from one 
UIManagedDocument, how do I properly copy the values from it to a newly 
inserted NSManagedObject subclass instance mo2 in the other UIManagedDocument?

Do I just run through all the properties I've defined for each attribute and do:
mo2.attribute = mo1.attribute
(which I could do by defining a method to do this)? I think this is ok, but I'm 
not 100% certain since these come from different NSManagedObjectContext 
instances so I want to be certain that won't cause a problem. Do all the 
properties need to be copy properties vs. strong/retain properties for this to 
work?

Or is there a better/simpler way to do this?

Also, I asked another Core Data question about four days ago, but never got a 
response. If you can answer this one too, that would be great.

=======================

If I create a child context of type NSMainQueueConcurrencyType such as:

   context = [[NSManagedObjectContext alloc] 
initWithConcurrencyType:NSMainQueueConcurrencyType];
   [context setParentContext:mainContext];

do I need to call [context performBlock:^{ // some code }];

or can I just use the context normally if I know the code is being executed on 
the main thread/queue?

Similarly, do I need to use performBlock on the UIManagedDocument's 
managedObjectContext property when I know the code is being executed on the 
main thread?

I think the answer to both questions is "no, you do not need to use 
performBlock", but I'd like to be certain.

=====================

Thanks,
Dave

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to