I am trying to archive / unpack NSManagedObjectIDs in Core Data objects, so the next time my application starts, I can get these identifiers and use them to retrieve specific objects.
I tried to "archive" the ID, for example:
ArchivedID* newID = [NSEntityDescription insertNewObjectForEntityForName:@"ArchivedID" inManagedObjectContext:managedObjectContext];
[self.defaultConfiguration addArchiveIDObject:newID];
newID.idURI = [[newObject objectID] URIRepresentation];
[managedObjectContext save:&error];
And then unarchive like this (I just want [anyObject] because I am testing and there is only one):
NSManagedObjectID* ID = [managedObjectContext.persistentStoreCoordinator managedObjectIDForURIRepresentation:[defaultConfiguration.archiveID anyObject]];
But when I try to get the url as above, I get the following exception:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ArchivedID relativeString]: unrecognized selector sent to instance 0x7f59f20'
The attribute in the object was set using Xcode to "transformable", and I left the transformer value field in Xcode empty, since the Core Data documentation seems to imply that it uses the default transformer empty.
What am I doing wrong?