What does this part of Apple core data documentation means?
User Info Dictionaries
Many of the elements in a managed object model—entities, attributes, and relationships—have an associated user info dictionary. You can put whatever information you want into a user info dictionary, as key-value pairs. Common information to put into the user info dictionary includes version details for an entity, and values used by the predicate for a fetched property.
I understand that by default entities have that dictionary, but I'm not able to find find userInfo on coredata entities or attributes.
Get the NSEntityDescription
from your NSManagedObject
(through the entity
property) or from your NSManagedObjectModel
and get the NSAttributeDescription through attributesByName. This gives you a dictionary where you get the proper Description by name which has the userInfo
as a property as well.
NSManagedObject *managedObject;
NSEntityDescription *entityDescription = managedObject.entity;
NSAttributeDescription *attributeDescription = entityDescription.attributesByName[@"someAttribute"];
NSString *foo = attributeDescription.userInfo[@"foo"];
来源:https://stackoverflow.com/questions/17230614/userinfo-dictionaries-on-coredata