RestKit 0.2x: checking for a condition at inserting time

那年仲夏 提交于 2019-12-25 01:53:45

问题


I have setup my project to use restKit with core data (1 entity) without problems, however, I intentionally left 1 boolean attribute without mapping for some app design purpose. I want to set this boolean according to a condition related to the current record being inserted, i.e. if this record contains a property that equals xxx then set this boolean to YES. how can I do something like this with restKit 0.2x at the time of inserting that record in the persistent store.

thanks in advance.


回答1:


In you NSManagedObject subclass, override willSave and implement your check and set your Boolean values. This will ensure that everything is up to date before RestKit completes the mapping process.



来源:https://stackoverflow.com/questions/17333424/restkit-0-2x-checking-for-a-condition-at-inserting-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!