Where does extra 'p' in NSManagedObjectID come from?

69 Views Asked by At

I am forming an NSManagedObjectID like this:

 NSManagedObjectID *objectID = [store newObjectIDForEntity: entityForPlayer 
                                           referenceObject: GKLocalPlayer.localPlayer.playerID];

store is an NSIncrementalStore. In the debugger GKLocalPlayer.localPlayer.playerID looks like G:12345678 but objectID looks like <x-coredata://<UUID>/Player/pG:12345678>.

Where does the extra p (before the verbatim player ID) come from? It apparently does not show up with other entity types, which also use NSStrings as reference objects.

1

There are 1 best solutions below

1
On BEST ANSWER

Educated guess, because it's an implementation detail:

The p means something like permanent, because the object has been saved to the store. i.e. [objectID isTemporaryID] == NO.

It'll be a t if the objects hasn't been saved yet. i.e. [objectID isTemporaryID] == YES.