Re: managedObjectIDForURIRepresentation returning wrong NSManagedObjectID
Re: managedObjectIDForURIRepresentation returning wrong NSManagedObjectID
- Subject: Re: managedObjectIDForURIRepresentation returning wrong NSManagedObjectID
- From: Mike Abdullah <email@hidden>
- Date: Fri, 08 Feb 2013 11:49:25 +0000
On 8 Feb 2013, at 09:06, Ben <email@hidden> wrote:
> I'm confused by the following code. What I'm trying to do is store a reference in a DogManagedObject transformable property, to a CatManagedObject, then retrieve the Cat from the Dog at a later date.
> However, when I log the output I get a class of 'Dog' rather than 'Cat'.
Make sure you're aware of the consequences of this. Managed objects only have a *temporary* ID until they are first saved. Only once assigned a permanent ID can you reasonably rely on looking up the object in future.
That said, why not use a relationship here?
_______________________________________________
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