Search code examples
iosobjective-crestrestkit

Using RestKit to map Login Responses


Been working with RestKit for a while now, but I am running into a difficult problem with ObjectMapping. I have a login API that requires me to post two key values as follows:

 {"fb_access_token":"123456789.....",
 "fb_user_id":"1234..."}

It returns:

 {"message":"logged in"}

I created the following classes to map the POST submission and the response in the following gist:

https://gist.github.com/2764803

I can post and login without mapping the response as in this gist:

https://gist.github.com/2764823

What is the best way to map a post and response like this?


Solution

  • You need to use RKObjectManager instead of RKClient in order to make proper use of the elegant object mapping mechanisms. All you need is explained in this RestKit wiki page. If you have further questions after reading, please ask away.