[英]How to get column names of table using coredata
In my iPhone application I have used coredata. 在我的iPhone应用程序中,我使用了coredata。
I want columnnames (fieldname) of table using coredata. 我想要使用coredata的表的列名(fieldname)。
I have search for that but not finding way to get it. 我已经找到了,但没有找到方法来获得它。
Thanks for any help. 谢谢你的帮助。
NSManagedObjectModel
has a method called entities
that gives a bunch of NSEntityDescription
(tables) and in that class you find attributesByName
and relationshipsByName
which gives you the columns. NSManagedObjectModel
有一个称为entities
的方法,它提供了一堆NSEntityDescription
(表),在该类中,您可以找到attributesByName
和relationshipsByName
,它们为您提供了列。
The model you can get by calling [[<yourManagedObjectContext> persistentStoreCoordinator] managedObjectModel]
. 您可以通过调用[[<yourManagedObjectContext> persistentStoreCoordinator] managedObjectModel]
获得该模型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.