我已经创建了一些ManagedObjects,并为每个人添加了用户信息 DisplayName
的键值/值示例:
Attribute: eReader
User Info Key: DisplayName
User Info Value: E-Reader
Attribute: weather
User Info Key: DisplayName
User Info Value: Weather Radar
我希望从代码中查询整个 NSManagedObject ,然后遍历每个属性并在屏幕上显示 DisplayName 。关于如何做到这一点的任何指导?
这样我就可以显示一个User Readable文本表,但每个条目都映射到正确的NSManagedObject属性,该属性不能以大写字母开头或者在其中有空格。
答案 0 :(得分:0)
我在UserInfo Dictionaries on CoreData
找到了答案for (NSString *key in [ei.attributesAsDictionary allKeys]) {
NSAttributeDescription *attributeDescription = eiEd.attributesByName[key];
NSString *displayName = attributeDescription.userInfo[@"DisplayName"];
}