Reputation: 5113
I'm using Restkit object mapping with the nested json data below. It will works great and each song object has a relevant rapper object. Except as you see below the rapper is the same for both songs, but each song object has a separate instance of a rapper object, so they don't match up when comparing. Is there a way to have Restkit use the same instances if they exist based on the unique id?
{
"id": "1",
"user_id": "200",
"filename": "filename1.mp3",
"mdate": "1250191261"
"rapper": {
"name": "Rap King",
"id": "200"
}
},
{
"id": "2",
"user_id": "200",
"filename": "filename2.mp3",
"mdate": "1345630910",
"rapper": {
"name": "Rap King",
"id": "200"
}
}
Upvotes: 0
Views: 200
Reputation: 10633
If you are using a Core Data backed mapping you need to set primaryKeyAttribute=@"id"
on your RKManagedObjectMapping
.
Upvotes: 1