简体   繁体   English

如何使用coredata获取表的列名

[英]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 (表),在该类中,您可以找到attributesByNamerelationshipsByName ,它们为您提供了列。

The model you can get by calling [[<yourManagedObjectContext> persistentStoreCoordinator] managedObjectModel] . 您可以通过调用[[<yourManagedObjectContext> persistentStoreCoordinator] managedObjectModel]获得该模型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM