Through RestKit Im loading a XML which looks like that:
<item>
<test_number>1</test_number>
<test_question>test question</test_question>
<test_answer>test answer</test_question>
</item>
<item>
<test_number>2</test_number>
<test_question>test question 2</test_question>
<test_question>test question 2</test_question>
</item>
...
In my core data I have got my Item objects which have got the data. If im loading the xml I want to have my core data objects updated, only inserted if the object isn’t already existing in core data. Normally I would set the primary key that RestKit is able to recognize which object can be updated. But in my case I can have multiple items with the same test number, but other question and answer. So there is no primary key. How can I do the mapping for that in RestKit?
As I found out through some forums and documentations – RestKit needs a primary key to map the objects to CoreData. Otherwise it creates just new objects instead of updating the right ones.
One solution can be to generate a own primary key with the important fields and then work with that. Another approach would be to map everything manually instead of the automatic mapping with RestKit.