本文介绍了NSManagedObject属性数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为我的NSManagedObject获取一个属性数组,所以我可以使用KVO来导出它们。我可以手动创建一个数组,然后遍历它,但是,我想自动获得这个列表,然后迭代。
I'd like to get an array of the attributes for my NSManagedObject so I can use KVO to export them. I can create an array manually and then iterate through it, however, I'd like to get this list automatically, then iterate.
推荐答案
p> NSManagedObject具有与其相关联的实体。使用的-attributesByName和-relationshipsByName 。你会得到一个字典从每个这些方法。只要询问他们的-allKeys。
An NSManagedObject has an entity associated with it. Use NSEntityDescription's -attributesByName and -relationshipsByName. You'll get a dictionary back from each of those methods. Just ask the dicts for their -allKeys.
这篇关于NSManagedObject属性数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!