Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9028233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:56:09+00:00 2026-06-16T06:56:09+00:00

I am creating an IOS app that uses restkit and I am able to

  • 0

I am creating an IOS app that uses restkit and I am able to do GET requests no problem and it maps correctly and everything however, I am having trouble getting restkit to do a POST to the database. It is getting a response that is saying:

`{"errors":{"email":["can't be blank"],"password":["can't be blank"]}}`

I have a feeling that the object is just not being sent. Here is my code to set up all the mappings, in my app delegate.

RKObjectMapping *userMapping     = [RKObjectMapping mappingForClass:[User       class]];
RKObjectMapping *dogMapping      = [RKObjectMapping mappingForClass:[Dog        class]];
RKObjectMapping *posttimeMapping = [RKObjectMapping mappingForClass:[PostTime   class]];
RKObjectMapping *postMapping     = [RKObjectMapping mappingForClass:[Post       class]];
RKObjectMapping *activityMapping = [RKObjectMapping mappingForClass:[Activity   class]];

        // set up which attributes go where
[userMapping        addAttributeMappingsFromDictionary:[User propertyMappings]];
[dogMapping         addAttributeMappingsFromDictionary:[Dog propertyMappings]];
[posttimeMapping    addAttributeMappingsFromDictionary:[PostTime propertyMappings]];
[postMapping        addAttributeMappingsFromDictionary:[Post propertyMappings]];
[activityMapping    addAttributeMappingsFromDictionary:[Activity propertyMappings]];

        // set up relationships
[userMapping        addRelationshipMappingWithSourceKeyPath:@"dogs"         mapping:dogMapping];
[dogMapping         addRelationshipMappingWithSourceKeyPath:@"timeline"     mapping:posttimeMapping];
[posttimeMapping    addRelationshipMappingWithSourceKeyPath:@"posts"        mapping:postMapping];
[postMapping        addRelationshipMappingWithSourceKeyPath:@"activities"   mapping:activityMapping];


    // what to print
RKLogConfigureByName("RestKit/Network", RKLogLevelTrace);
RKLogConfigureByName("Restkit/Network", RKLogLevelDebug);



    // set up paths
RKObjectManager *manager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://localhost:3000"]];

NSIndexSet *statusCodes = RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful); // Anything in 2x
RKResponseDescriptor *userDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:userMapping pathPattern: @"/users/1.json" keyPath:@"" statusCodes:statusCodes];
RKResponseDescriptor *signupDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:userMapping pathPattern:@"/users.json" keyPath:@"" statusCodes:statusCodes];
[manager addResponseDescriptorsFromArray:@[ userDescriptor, signupDescriptor ]];
[RKObjectManager setSharedManager:manager];

and here is my post request:

- (void) post{
RKObjectManager *manager = [RKObjectManager sharedManager];
[manager postObject:self path:@"/users.json" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
    NSLog(@"successful post");
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
    NSLog(@"failed post %@", error);
    NSLog(@"%@",operation.description);
    NSLog(@"%@",operation.HTTPRequestOperation.description);
}];

}

Here are the logs I am getting:

2012-12-19 11:23:15.657 Dogapp[6353:4303] T restkit.network:RKHTTPRequestOperation.m:139     POST 'http://localhost:3000/users.json':
 request.headers={
 Accept = "application/json";
"Accept-Language" = "en, fr, de, ja, nl, it, es, pt, pt-PT, da, fi, nb, sv, ko, zh-Hans, zh-Hant, ru, pl, tr, uk, ar, hr, cs, el, he, ro, sk, th, id, ms, en-GB, ca, hu, vi, en-us;q=0.8";
"Content-Type" = "application/x-www-form-urlencoded; charset=utf-8";
"User-Agent" = "Dogapp/1.0 (iPhone Simulator; iOS 6.0; Scale/1.00)";
}request.body=(null)
2012-12-19 11:23:15.680 Dogapp[6353:190b] T restkit.network:RKHTTPRequestOperation.m:156     POST 'http://localhost:3000/users.json' (422):  
response.headers={
"Cache-Control" = "no-cache";
Connection = "Keep-Alive";
"Content-Length" = 69;
"Content-Type" = "application/json; charset=utf-8";
Date = "Wed, 19 Dec 2012 16:23:15 GMT";
Server = "WEBrick/1.3.1 (Ruby/1.9.3/2012-04-20)";
"Set-Cookie" =     "_cms_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJTRjMTdjZDNiOGVmNDY0MGFjY2NiZWJjNTUwOGQxZDU3BjsAVA%3D%3D--d553a2616530bbe5346fdafc4d6fca81ecc6f6f7; path=/; HttpOnly";
"X-Request-Id" = 5edef73ca7b5ddbc4e510e9799835324;
"X-Runtime" = "0.007666";
"X-Ua-Compatible" = "IE=Edge";
}
response.body={"errors":{"email":["can't be blank"],"password":["can't be blank"]}}
2012-12-19 11:23:15.682 Dogapp[6353:c07] failed post Error   Domain=org.restkit.RestKit.ErrorDomain Code=1001 "Unable to find any mappings for the given    content" UserInfo=0x95bcb20 {DetailedErrors=(
), NSLocalizedDescription=Unable to find any mappings for the given content, keyPath=null}
2012-12-19 11:23:15.683 Dogapp[6353:c07] mappingResult: <RKObjectRequestOperation:  0x75e73b0, state: Failed, isCancelled=NO, request: <NSMutableURLRequest    http://localhost:3000/users.json>, response: <NSHTTPURLResponse: 0x75f4580 statusCode=422  MIMEType=application/json length=69>>
2012-12-19 11:23:15.683 Dogapp[6353:c07] <RKObjectRequestOperation: 0x75e73b0, state: Failed, isCancelled=NO, request: <NSMutableURLRequest http://localhost:3000/users.json>, response: <NSHTTPURLResponse: 0x75f4580 statusCode=422 MIMEType=application/json length=69>>
2012-12-19 11:23:15.683 Dogapp[6353:c07] <RKHTTPRequestOperation: 0x75e78e0, state: isFinished, cancelled: NO request: <NSMutableURLRequest http://localhost:3000/users.json>, response: <NSHTTPURLResponse: 0x75f4580>>

Any example or point in the right direction would be amazing. I have been stuck on this for a while.

If you need any more information just let me know.

Update

I was able to get it to work but not the correct way.Basically I just send all of the information through the params like so.

- (void) post{
RKObjectManager *manager = [RKObjectManager sharedManager];
[manager postObject:self path:@"/users.json" parameters:@{@"user[email]" : self.email, @"user[password]" : self.password}  success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
    NSLog(@"Successful Post!");
    [User setCurrentUser:self];
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[error description] delegate:nil cancelButtonTitle:@"Okay!" otherButtonTitles: nil];
    [alert show];
}];

}

Anyone have any ideas to how to do it correctly?

Update for Vishal
For using coredata you have to create an Managed Object Store like this…

 RKObjectManager *manager = [RKObjectManager managerWithBaseURL:    [NSURL URLWithString:@"http://my_url.com"]];
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"MyDataModel" withExtension:@"momd"];
NSManagedObjectModel *managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel];
manager.managedObjectStore = managedObjectStore;

Then you’re going to have to use RKEntityMapping instead of RKObjectMapping

Hope this helps.

Update 2 for Vishal

[managedObjectStore createPersistentStoreCoordinator];
NSError *error;

BOOL success = RKEnsureDirectoryExistsAtPath(RKApplicationDataDirectory(), &error);
if (! success) {
    RKLogError(@"Failed to create Application Data Directory at path '%@': %@", RKApplicationDataDirectory(), error);
}
NSString *path = [RKApplicationDataDirectory() stringByAppendingPathComponent:@"Store.sqlite"];
NSPersistentStore *persistentStore = [managedObjectStore addSQLitePersistentStoreAtPath:path fromSeedDatabaseAtPath:nil withConfiguration:nil options:nil error:&error];
if (! persistentStore) {
    RKLogError(@"Failed adding persistent store at path '%@': %@", path, error);
}

[managedObjectStore createManagedObjectContexts];
managedObjectStore.managedObjectCache = [[RKInMemoryManagedObjectCache alloc] initWithManagedObjectContext:managedObjectStore.persistentStoreManagedObjectContext];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:56:10+00:00Added an answer on June 16, 2026 at 6:56 am

    I was dealing with the same problem. You are missing request mapping. You’re only describing response.

    Example code:

    RKRequestDescriptor *requestDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:userMapping 
        objectClass:[User class] rootKeyPath:nil];
    
    [objectManager addRequestDescriptor: requestDescriptor];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating an iOS app that needs to get a lot of information from
I'm creating an app that tracks your elevation. Currently IOS is one of the
I'm currently creating an iPhone app (Xcode 4.3.1, IOS 5) that could use Bluetooth
Problem : I am creating an iOS chat app using the XMPPFramework and an
I am creating an iOS app that deals with real estate listings. The current
I am creating an iOS app that consumes web services. I have a class
I have an iOS app that uses a SQLite DB to store its data
I'm creating iOS app that has a label. I want to set two colors.
I am creating an iOS app that reads data from a single SQLITE table
I am creating an iOS app that reads data from an xml file. One

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.