问题
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