You cannot store NSManagedObjectID in a CoreData object, and it does not have any properties that can be defined as integer or string identifiers. Therefore, creating your own unique identifier algorithm is an acceptable solution, if you canβt keep track of when the object is saved, I did this for some applications.
For example, I had a similar problem when I needed to populate UITableView cells with an object reference and get the object after clicking / touching the cell.
I found a suggestion using the uri view, but , but I still need to save the context until , but I manage to use the NSFetchedResultsController and find a stronger solution, rather than the built-in application identifier.
[[myManagedObject objectID] URIRepresentation];
Then you can later get the identifier of the managed entity:
NSManagedObjectID* moid = [storeCoordinator managedObjectIDForURIRepresentation:[[myManagedObject objectID] URIRepresentation]];
And with moid, I could get your managed entity.
source share