[英]What's the difference between “attribute” and “property” in restkit
I am new for iOS RestKit framework. 我是iOS RestKit框架的新手。 I have read the document and still can not figure out the differences between "attribute" and "property" in RestKit.
我已经阅读了文档,仍然无法弄清RestKit中“属性”和“属性”之间的区别。
Since in the document, there are 由于文件中有
- addPropertyMappingsFromArray:
and 和
– addAttributeMappingsFromArray:
I know that while assigning relationship, I should use the first one. 我知道在分配关系时,我应该使用第一个。 However, I still cannot truly understand the differences.
但是,我仍然无法真正理解这些差异。
I just ran into this myself. 我只是碰到这个自己。 The naming could definitely be clearer.
命名肯定可以更清楚。
- addAttributeMappingsFromArray:
refers to what you would expect: mappings of class attributes. - addAttributeMappingsFromArray:
指您期望的:类属性的映射。 - addPropertyMappingsFromArray:
on the other hand refers to RKPropertyMapping
objects. - addPropertyMappingsFromArray:
另一方面是指RKPropertyMapping
对象。
If you take a look at the RestKit source you'll see that all the 'addAttributeMappings' methods are a handy abstraction on top of the 'addPropertyMappings' methods, and take care of constructing the required RKPropertyMapping
objects for you. 如果您查看RestKit的源代码,您会发现所有的'addAttributeMappings'方法都是在'addPropertyMappings'方法之上的便捷抽象,并为您构造必需的
RKPropertyMapping
对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.