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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:14:23+00:00 2026-06-17T12:14:23+00:00

In my code i want to create tableView with List sections. I use scheme

  • 0

In my code i want to create tableView with List sections. I use scheme like this one:

enter image description here

I use NSFetchResultController which i define in this way:

- (NSFetchedResultsController *)fetchedResultsController {

    if (_fetchedResultsController != nil) {
        return _fetchedResultsController;
    }
    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription
                               entityForName:@"Item" inManagedObjectContext:coreDataController.masterManagedObjectContext];
    [fetchRequest setEntity:entity];

    NSSortDescriptor *sort = [[NSSortDescriptor alloc]
                          initWithKey:@"addedAt" ascending:YES];
    [fetchRequest setSortDescriptors:[NSArray arrayWithObject:sort]];

    [fetchRequest setFetchBatchSize:20];

    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"itemIsChecked = 1"];

    [fetchRequest setPredicate:predicate];
    [fetchRequest setResultType:NSDictionaryResultType];

    NSFetchedResultsController *theFetchedResultsController =
    [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
                                    managedObjectContext:coreDataController.masterManagedObjectContext sectionNameKeyPath:@"toList.listName"
                                               cacheName:nil];
    self.fetchedResultsController = theFetchedResultsController;
    _fetchedResultsController.delegate = self;

    return _fetchedResultsController;
}

Now in cellForRowAtIndexPath: i want to get data form my fetchResultController, so i do this in way:

Item *item = [self.fetchedResultsController objectAtIndexPath:indexPath];

and then if i want to access one of the item’s field (for example itemText), it crash:

NSLog(@"item itemtext = %@", item.itemText);

with error:

-[NSKnownKeysDictionary1 itemText]: unrecognized selector sent to instance 0x1215fd90

What i do wrong in my code?

  • 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-17T12:14:25+00:00Added an answer on June 17, 2026 at 12:14 pm

    You have set

    [fetchRequest setResultType:NSDictionaryResultType];
    

    and therefore the fetched results controller returns NSDictionary objects, not Item objects. So your element

    Item *item = [self.fetchedResultsController objectAtIndexPath:indexPath];
    

    is a NSDictionary, not an Item. Since dictionaries do not have a itemText method, item.itemText crashes. You could retrieve the value from the dictionary with

    NSDictionary *item = [self.fetchedResultsController objectAtIndexPath:indexPath];
    NSLog(@"item itemtext = %@", [item objectForKey:@"itemText"]);
    

    But if you don’t have a specific reason to set the result type to NSDictionaryResultType, you should just delete that line. Change tracking of the fetched results controller (i.e. automatic table view updates) do not work with resultType == NSDictionaryResultType.

    Note also that if you have set a sectionNameKeyPath, then you must add a sort descriptor with the same key path “toList.listName” and use it as first sort descriptor for the fetch request.

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

Sidebar

Related Questions

I want to create Primefaces tabs from Java List. I tested this code: <p:tabView
in my python code i want to create a list of lists...in a loop
i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =
I want to create an item to sitecore using code behind. I found this
I want to create tabs which will show certain views I create through code.
i want to create an application in one row of tableView there will be
I want two create 2 sections uitableview so I did the following code -
i want to create a validatior via code behind.But although i create it,it doesnt
I want to create 1MB String for benchmark,so I writed code as follow: public
I want to create a file with a block of code in it and

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.