Adding mapping error: Expected an object mapping for class of type...

370 vistas
Ir al primer mensaje no leído

Benjamin Willard

no leída,
30 dic 2011, 9:54:11 p.m.30/12/2011
para RestKit
I have an error here that I am trying to figure out what I can do make
it work...

First of all The data that I get is not always the same class object.
For example... When login is called it can return a few things...
(LoginResponse) or (LogResponse). These two are shared one is to give
successful login and the other is to handle an error that was
performed when this happens I perform an Alert to the current user.

I am getting a Adding mapping error: Expected an object mapping for
class of type 'LoginRequest', provider returned one for 'LogResponse'.

If I do successful it gives same error but:

I am getting a Adding mapping error: Expected an object mapping for
class of type 'LoginRequest', provider returned one for
'LoginResponse'.

How can I do this correctly in the mapping so that it knows that
LoginRequest can accept both LogResponse and LoginResponse...???

Ben

Ray Fix

no leída,
30 dic 2011, 10:28:08 p.m.30/12/2011
para res...@googlegroups.com

When you post your login object, use the one that takes the loader block configuration.  Then set loader.targetObject = nil;  I think this will make it map using the rootKeyPaths that your response returns.  (Someone please correct me if I am mistaken.)

 [[RKObjectManager sharedManager] postObject:loginObject 
   delegate:self block:^(RKObjectLoader* loader) {
   loader.resourcePath = @"/login";
   loader.targetObject = nil;

Benjamin Willard

no leída,
30 dic 2011, 10:48:52 p.m.30/12/2011
para RestKit
Thanks a lot Ray, that really helped save me a headache and thanks for
the quick response...

Basically i made it so that my Web Service allows me to send KVC
concept that helps solves all problems for the future as I have
wrapper methods going towards my "Process" which handles ALL requests
and handles all responses...

Ben
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos