What does the x-coredata path mean when I 'po' the core data object in lldb?
core-data, ios, objective-c
Solution
When you first print the object it has not been assigned to a persistent store:
(lldb) po my_challenge_object
<Challenge: 0x1700da1d0> (entity: Challenge; id: 0x170433460 <x-coredata:///Challenge/t52BD558C-A8FE-4064-A8BE-217A837521E52> ; data: {...})
Thats why there are three slashes after the colon in the managed object ID.
In the second instance, it has been assigned to a persistent store with the identifier "50232AB5-7372-4628-9F00-51BDB1A5C96D".
<Challenge: 0x1700da1d0> (entity: Challenge; id: 0x170433460 <**x-coredata://50232AB5-7372-4628-9F00-51BDB1A5C96D/Challenge/t52BD558C-A8FE-4064-A8BE-217A837521E52**> ; data: {...})
The structure of a managed object ID URI is generally as follows:
x-coredata://[Store UUID]/[Entity Name]/[Primary Key]
Note: that the [Primary Key] section is store specific, and may refer to the pk of a sqlite row or some other identifier in an XML or Binary store.
The store UUID is available from the store's metadata dictionary, or by asking an instance of NSPersistentStore for its identifier:
NSLog(@"Store Identifier: %@", [store identifier]);
Problem
When I print an object description for a core data object in lldb I'll sometimes get the following object description: (lldb) po my_challenge_object (entity: Challenge; id: 0x170433460 <x-coredata:///Challenge/t52BD558C-A8FE-4064-A8BE-217A837521E52> ; data: {...}) If I print the same object at a later time, I'll sometimes see the 'x-coredata' path change. (entity: Challenge; id: 0x170433460 <x-coredata://50232AB5-7372-4628-9F00-51BDB1A5C96D/Challenge/t52BD558C-A8FE-4064-A8BE-217A837521E52> ; data: {...}) My question is, what does that path mean and why is it changing? What does the addition of '50232AB5-7372-4628-9F00-51BDB1A5C96D' tell me about my object, in this case?