开发者

How can I check the property attribute dynamically in Core Data / iPhone?

I ha开发者_开发技巧ve a line of code like this in a function:

....[record valueForKey:fieldName]....;

It (the part shown) works fine and gets the value I am searching for, from core data.

Is there a way I can test the type of this piece of data ? I mean its property attribute in the core data entity. In other words I want to test if it is String or Float or ....


You can get it from NSAttributeDescription that is stored in the NSEntityDescription

You can get the entity description by name from you managedobjectmodel.

This description contains attributes which are all of the NSAttributeDescription type. An AttributeDesciption contains an variable called attributeType.
See:
enter link description here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜