【问题标题】:Equivalent of attributesByName core data method in Realm / Get properties/attributes of RLMObject等价于 Realm 中的 attributesByName 核心数据方法 / 获取 RLMObject 的属性/属性
【发布时间】:2015-06-03 14:40:16
【问题描述】:

如果我有这样的实体,在核心数据中

NSEntityDescription *entity = [NSEntityDescription entityForName:entityName inManagedObjectContext:managedObjectContext];

我可以通过方法获取它的属性

NSDictionary *entityAttributes = [entity attributesByName];

我想知道在 Realm 中方法 attributesByName 的等价物是什么。我需要一些能够返回属性名称和属性类型的东西。一直在他们的文档中搜索,但似乎找不到可用的类似功能。

【问题讨论】:

    标签: ios core-data properties attributes realm


    【解决方案1】:

    根据文档,我认为您可以从RLMObject 开始走这条路。

    object.objectSchema.properties
    

    这应该给你一个RLMProperty类型的对象数组。您在此类的 name 属性中有名称。通常存储在类型NSAttributeDescription 的值部分中的大多数信息也可以在此类中找到:例如type

    【讨论】:

      猜你喜欢
      • 2015-04-24
      • 2012-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多