Chris Truman
Chris Truman

Reputation: 903

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?

Upvotes: 0

Views: 203

Answers (2)

clopez
clopez

Reputation: 4372

you could try something like this

Making a post to API with RKParams and mapping the response with RKObjectMapping using RestKit

I tried the solution posted here but it didn't work so well for me.

Upvotes: 1

sebastian.gherman
sebastian.gherman

Reputation: 103

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.

Upvotes: 1

Related Questions