Apple 核心数据文档的这一部分是什么意思?
What does this part of Apple core data documentation means?
用户信息词典
托管对象模型中的许多元素(实体、属性和关系)都有关联的用户信息字典.您可以将所需的任何信息作为键值对放入用户信息字典中.放入用户信息字典的通用信息包括实体的版本详细信息,以及用于获取属性的谓词的值.
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.
我了解默认情况下实体具有该字典,但我无法在 coredata 实体或属性上找到 userInfo.
I understand that by default entities have that dictionary, but I'm not able to find find userInfo on coredata entities or attributes.
从 NSManagedObject 获取 NSEntityDescription(通过 entity 属性)或从您的 NSManagedObjectModel 并通过 attributesByName 获取 NSAttributeDescription.这为您提供了一个字典,您可以在其中按名称获取正确的描述,其中 userInfo 作为属性也是如此.
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"];
这篇关于CoreData 上的 UserInfo 字典的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
出现键盘时如何在iOS上调整UITextView的大小?How to resize UITextView on iOS when a keyboard appears?(出现键盘时如何在iOS上调整UITextView的大小?)
如何可靠地检测 iOS 9 上是否连接了外部键盘?How to reliably detect if an external keyboard is connected on iOS 9?(如何可靠地检测 iOS 9 上是否连接了外部键盘?)
如何在 iOS 7 上模拟键盘动画以添加“完成"数How to mimic Keyboard animation on iOS 7 to add quot;Donequot; button to numeric keyboard?(如何在 iOS 7 上模拟键盘动画以添加“完成数字键
如何关闭 iOS 键盘?How do I dismiss the iOS keyboard?(如何关闭 iOS 键盘?)
是否可以在 ios 越狱后使用外部键盘模拟触摸事件Is possible to simulate touch event using an external keyboard on ios jailbroken?(是否可以在 ios 越狱后使用外部键盘模拟触摸事件?)
如何从 iOS 应用程序上的自定义键盘检索击键?How do I retrieve keystrokes from a custom keyboard on an iOS app?(如何从 iOS 应用程序上的自定义键盘检索击键?)