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

Showing 1-3 of 3 messages
Adding mapping error: Expected an object mapping for class of type... Benjamin Willard 12/30/11 6:54 PM
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
Re: [RestKit] Adding mapping error: Expected an object mapping for class of type... Ray Fix 12/30/11 7:28 PM

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;
Re: Adding mapping error: Expected an object mapping for class of type... Benjamin Willard 12/30/11 7:48 PM
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