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 8874331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:41:35+00:00 2026-06-14T18:41:35+00:00

So I switched to using RestKit 0.2 and CoreData and I’ve been having a

  • 0

So I switched to using RestKit 0.2 and CoreData and I’ve been having a lot of trouble trying to get the mappings correct… I don’t understand why. The JSON Response of my server is like this:

{
"meta": 
   {
   "limit": 20, 
   "next": null, 
   "offset": 0, 
   "previous": null, 
   "total_count": 2
   }, 
   "objects": 
   [{
       "creation_date": "2012-10-15T20:16:47", 
       "description": "", 
       "id": 1, 
       "last_modified": 
       "2012-10-15T20:16:47", 
       "order": 1, 
       "other_names": "", 
       "primary_name": "Mixing",
       "production_line": "/api/rest/productionlines/1/", 
       "resource_uri": "/api/rest/cells/1/"
   }, 
   {
       "creation_date": "2012-10-15T20:16:47", 
       "description": "",
       "id": 2, 
       "last_modified": "2012-10-15T20:16:47",
       "order": 2, "other_names": "", 
       "primary_name": "Packaging", 
       "production_line": "/api/rest/productionlines/1/",
       "resource_uri": "/api/rest/cells/2/"
   }]
}

Then in XCode I have:

RKObjectManager *objectManager = [RKObjectManager sharedManager];

[AFNetworkActivityIndicatorManager sharedManager].enabled = YES;

NSManagedObjectModel *managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil];
RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel];
objectManager.managedObjectStore = managedObjectStore;


RKEntityMapping *cellMapping = [RKEntityMapping mappingForEntityForName:@"Cell" inManagedObjectStore:managedObjectStore];
cellMapping.primaryKeyAttribute = @"identifier";
[cellMapping addAttributeMappingsFromDictionary:@{
 @"id": @"identifier",
 @"primary_name": @"primaryName",
 }];



RKResponseDescriptor *responseCell = [RKResponseDescriptor responseDescriptorWithMapping:cellMapping
                                                                             pathPattern:@"/api/rest/cells/?format=json"
                                                                                 keyPath:@"objects"
                                                                             statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];


[objectManager addResponseDescriptorsFromArray:@[responseCell, responseUser, responseCompany]];


[managedObjectStore createPersistentStoreCoordinator];
NSString *storePath = [RKApplicationDataDirectory() stringByAppendingPathComponent:@"AppDB.sqlite"];
NSString *seedPath = [[NSBundle mainBundle] pathForResource:@"SeedDatabase" ofType:@"sqlite"];
NSError *error;
NSPersistentStore *persistentStore = [managedObjectStore addSQLitePersistentStoreAtPath:storePath fromSeedDatabaseAtPath:seedPath withConfiguration:nil options:nil error:&error];
NSAssert(persistentStore, @"Failed to add persistent store with error: %@", error);

// Create the managed object contexts
[managedObjectStore createManagedObjectContexts];

// Configure a managed object cache to ensure we do not create duplicate objects
managedObjectStore.managedObjectCache = [[RKInMemoryManagedObjectCache alloc] initWithManagedObjectContext:managedObjectStore.persistentStoreManagedObjectContext];

My request is:

    [[RKObjectManager sharedManager] getObjectsAtPath:@"/api/rest/cells/?format=json" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
        RKLogInfo(@"Load complete: Table should refresh...");

        [[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:@"LastUpdatedAt"];
        [[NSUserDefaults standardUserDefaults] synchronize];
    } failure:^(RKObjectRequestOperation *operation, NSError *error) {
        RKLogError(@"Load failed with error: %@", error);
    }];

And I always get the following error:

**Error Domain=org.restkit.RestKit.ErrorDomain Code=1001 "Unable to find any mappings for the given content" UserInfo=0x1102d500 {DetailedErrors=(), NSLocalizedDescription=Unable to find any mappings for the given content, keyPath=null}**

Thanks a lot!

UPDATE: I have added cellMapping.forceCollectionMapping = YES;
but still no luck :(!

UPDATE #2: Following Blake’s advice, I tried to change the path and it worked! I did /api/rest/cells/ instead of /api/rest/cells/?format=json and my server returned me everything and the mapping was successful!

Now the only problem I get is the following error:

2012-11-21 14:48:49.414 App[3125:617] W restkit.object_mapping:RKMapperOperation.m:176 Collection mapping forced but mappable objects is of type ‘__NSCFArray’ rather than NSDictionary

  • 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-14T18:41:36+00:00Added an answer on June 14, 2026 at 6:41 pm

    It sounds like the response descriptor is failing to match for the URL requested. Two ideas:

    1. Try removing the path pattern entirely (pass in nil) and just using a key-path based match on ‘cells’
    2. Try using a path pattern of ‘/api/rest/cells’

    The next thing I would try is using the debugger to step through the matching. Within RKObjectManager a list of candidate response mapping is built by the RKFilteredArrayOfResponseDescriptorsMatchingPath function. If your expected response mapping is not being returned in there, then the request path to path pattern is failing to evaluate.

    If things look good there, the next place a mismatch could occur is in RKResponseMapperOperation within the buildResponseMappingsDictionary method. This method evaluates the response against each response descriptor. If the response is failing to match against your response descriptor, then you’ll get unexpected results here.

    The final place to check is within RKResponseMapperOperation. This takes the mappings from matched descriptors and applies them. The RKMapperOperation main method should contain the deserialized response you expect and the appropriate mappings on the mappingsDictionary property.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have currently switched to using PDO but am having trouble in handling the
I've mainly been using Mono for Android via Visual Studio, but have switched over
I just switched to RestKit 0.2 and I am currently using the new HttpClient
I switched from using Visual Studio Ultimate 2010 and I am trying to work
I just switched to using the CSS Adapters for my TreeView control on one
I've switched from using constants for Strings to using enums. Many times I need
I recently switched from using Linq to Sql to the Entity Framework. One of
I am currently using a RadTreeView and just switched over to using Load-On-Demand (ServerSideCallback)
I am using NHibernate and switched from my local SQLExpress database to Oracle11g. My
I switched lecturers today and he stated using a weird code to me. (He

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.