I have a DiscussionBoard application running for RestKit and I am transferring the DBUser class to my application. The only difference is that my application will not use CoreData.
I can do a POST user object and return a new user id and authentication_token in my application. The problem is that the response does not serialize to the user object. Why request:didLoadResponse:response does not return a User object, but I can see the correct json in signUpWithDelegate:delegate
And you can see here, I can't get objectLoader:didLoadObjects to return using serialized objects? Why is the object not serializable?
[12881:207]Loaded payload: {"user":{"id":"85","authentication_token":"_Udl98OO-xgmZOOJM26w","email":" ffff@adsfadfa.com "}} [12881:207] _____ objectLoader didLoadObjects ( ) [12881:207] loginWasSuccessful (null)
AppDelegate.m
RKObjectManager *objectManager = [RKObjectManager objectManagerWithBaseURL:@"http://spoonbook-2.local:3000/"]; [objectManager.router routeClass:[RKUser class] toResourcePath:@"/api/v1/authentication/create.json" forMethod:RKRequestMethodPOST]; // User RKObjectMapping *userMapping = [RKObjectMapping mappingForClass:[RKUser class]]; [userMapping mapKeyPath:@"id" toAttribute:@"userId"]; [userMapping mapAttributes:@"email", nil]; [userMapping mapAttributes:@"authentication_token", nil]; [objectManager.mappingProvider setObjectMapping:userMapping forKeyPath:@"user"];
RegisterViewController.m
-(IBAction)handleLoginClick:(id)sender { NSLog(@"handleLoginClick"); RKUser *user = [[[RKUser alloc] init] retain]; [user createWithEmail:_regEmailTF.text andPassword:_regPasswordTF.text delegate:self]; [user release]; }
User.m
source share