lundi 7 juillet 2014

RestKit POSTed managed object becomes duplicate when response is enveloped in an array


Vote count:

0




When I POST a Core Data managed object using RestKit, RestKit doesn't update the existing object but creates a new object instead.


The returned JSON always contains the newly created object, but wraps it into a plural keyed array. I found that if I change this to just the one object, the updating works as expected.


I would like to keep the array in the response so that all responses are consistently in the plural form. I tried adding a second identificationAttribute that was set before the POST. My rationale was that RK could use that to identify the object in the local store, but it didn't work.


Is there any way I can make RestKit update the record, even when returned from the server wrapped in an array?


Example request



{
"user": {
"email": "example@example.com",
}
}


Response



{
"users": [{
"email": "example@example.com",
}]
}


asked 33 secs ago

Rengers

4,562





Aucun commentaire:

Enregistrer un commentaire