CORE DATA objectId changes constantly

Posted by mongeta on Stack Overflow See other posts from Stack Overflow or by mongeta
Published on 2010-05-12T13:34:55Z Indexed on 2010/05/12 14:44 UTC
Read the original article Hit count: 250

Filed under:
|

Hello,

I have some data that I export into an XML file and put in a remote FTP Server.

I have to identified each object with a unique attribute, it doesn't matter wich is, but must be persistent always => it can never change.

I don't want to create a unique attribute, sequence, serial, etc.

I'm using the objectID but every time I use it a get a new reference.

I know that before the object has been saved, it has a 'temporal id', but once it's saved, it gets the definitive.

I'm not seeing this, never.

When I export, just fetch all data and loop, and always I get a new reference:

NSURL *objectID = [[personalDataObject objectID] URIRepresentation];

// some of id received for the SAME OBJECT (no changes made, saved, ...)
// 61993296
// 62194624

thanks,

r.

edit

I was using %d instead of %@, now the returned data is:

x-coredata://F46F3300-8FED-4876-B0BF-E4D2A9D80913/DataEntered/p1
x-coredata://F46F3300-8FED-4876-B0BF-E4D2A9D80913/DataEntered/p2

© Stack Overflow or respective owner

Related posts about iphone

Related posts about core-data