Globaly unique NSManagedObjectID
Globaly unique NSManagedObjectID
- Subject: Globaly unique NSManagedObjectID
- From: Alexander Lamb <email@hidden>
- Date: Thu, 5 Jan 2006 11:49:13 +0100
Hello list,
I would like to send objects (NSManagedObjects or subclasses) from
one process to another. Each process being a CoreData application
with it's own data store.
I understand that once an object is persistant it gets an
NSManagedObjectID. This ID is globally unique.
Now, imagine I serialize my object in application A. I send it to
application B. I first check if an object with that same ID already
exists. If not, I insert my transfered object, if yes I apply some
kind of merge policy, modifying the already existant object (or not).
Questions:
- NSManagedObjectID is truely globally unique?
- Is there any reason I might not be able to serialize a
NSManagedObject (or subclass) with it's NSManagedObjectID?
- What happens if I insert an object in a NSManagedObjectContext when
it has already a NSManagedObjectID?
This last question is the most important. Indeed, the documentation
says "a temporary object ID will be assigned". Then a permanent ID is
given when saved. I don't want a new ID to be given since the first
one is already globally unique and will be my reference to an object
shared my many users (think synchronized caches and databases).
Another way would be to create a new object (if it doesn't exist yet
in application B), set the values and then "force" the setting of its
NSManagedObjectID to be the one received from application B.
Unfortunately I didn't find any place where one could SET the
NSManagedObjectID of a NSManagedObject.
Thanks for any hints,
--
Alexander Lamb
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden