【问题标题】:Accessing "User Info" dictionary in CoreData from IOS Application从 IOS 应用程序访问 CoreData 中的“用户信息”字典
【发布时间】:2014-09-05 12:12:36
【问题描述】:

我创建了一些 ManagedObjects,并为每个对象添加了 User Info 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。关于如何做到这一点的任何指导?

这样我可以显示一个用户可读文本表,但每个条目都映射到正确的 NSManagedObject 属性,该属性不能以大写开头或包含空格。

【问题讨论】:

    标签: ios core-data ios7


    【解决方案1】:

    我在这里找到了我的答案UserInfo Dictionaries on CoreData

    for (NSString *key in [ei.attributesAsDictionary allKeys]) {
        NSAttributeDescription *attributeDescription = eiEd.attributesByName[key];
        NSString *displayName = attributeDescription.userInfo[@"DisplayName"];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-09
      • 1970-01-01
      • 2019-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多