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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:40:04+00:00 2026-05-16T15:40:04+00:00

I have problems with my coredata sqlite DB, which hosts a book DB. After

  • 0

I have problems with my coredata sqlite DB, which hosts a book DB. After a crash a user experiences has the problem, that the data isn’t shown properly any more in his/her tableview.

This is due to the fact, that the performFetch method returns an error:

[NSFetchedResultsController deleteCacheWithName:nil];
if (![[self fetchedResultsController] performFetch:&error]) { 
        //NSArray *array = [[self fetchedResultsController] fetchedObjects];
        NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
#ifdef DEBUG
        abort();
#endif
    }

which results in this error message:

Unresolved error Error Domain=NSCocoaErrorDomain Code=134060 “The operation couldn’t be completed. (Cocoa error 134060.)” UserInfo=0x1dff80 {reason=The fetched object at index 312 has an out of order section name ‘Z. Objects must be sorted by section name’}, {
reason = “The fetched object at index 312 has an out of order section name ‘Z. Objects must be sorted by section name'”;

When I have a look into the sqlite file with ‘SQLite Database Browser 2.0 b1’ the attributes of each entity seem to be ok.

When I delete some of the entities being mentioned everything works fine again.

I would like to know how I can find out what exactly is wrong with the mentioned entities and fix that, so the user can use his/her data again. Of course I want to fix the bug which causes the malformed DB as well but that is out of focus in this post.

Does anybody have any hints where I could have a look at or what might be malformed within my DB or what “an out of order section name” is?

This is the code for my fetchedResultsController:

- (NSFetchedResultsController *)fetchedResultsController {

    if (fetchedResultsController != nil) {
        return fetchedResultsController;
    }


    // Create the fetch request for the entity.
    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    // Edit the entity name as appropriate.
    NSEntityDescription *entity;
    entity = [NSEntityDescription entityForName:@"Book" inManagedObjectContext:[[GlobalData sharedInstance] managedObjectContext]];
    [fetchRequest setEntity:entity];

    // Set the batch size to a suitable number.
    [fetchRequest setFetchBatchSize:10];

    //set searchPredicate
    NSPredicate *predicate = nil;
    if (self.bibList != nil) {
        predicate = [NSPredicate predicateWithFormat:@"ANY BibLists.name LIKE %@", self.bibList.name];      
    }

    if (predicate) {
        [fetchRequest setPredicate:predicate];
    }


    // Edit the sort key as appropriate.
    NSSortDescriptor *sortDescriptor;   
    NSString *sortDescriptorString = nil;       
    sortDescriptorString = @"title";
    sortDescriptor = [[NSSortDescriptor alloc] initWithKey:sortDescriptorString ascending:YES]; 
    NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];   
    [fetchRequest setSortDescriptors:sortDescriptors];

    NSString *sectionNameKeyPath = nil;
    sectionNameKeyPath = @"uppercaseFirstLetterOfTitle";

    // Edit the section name key path and cache name if appropriate.
    // nil for section name key path means "no sections".
    NSFetchedResultsController *aFetchedResultsController;
    aFetchedResultsController = [[NSFetchedResultsController alloc] 
                             initWithFetchRequest:fetchRequest 
                             managedObjectContext:[[GlobalData sharedInstance] managedObjectContext] 
                             sectionNameKeyPath:sectionNameKeyPath 
                             cacheName:@"Bibliography"];

    aFetchedResultsController.delegate = self;
    self.fetchedResultsController = aFetchedResultsController;

    [aFetchedResultsController release];
    [fetchRequest release];
    [sortDescriptor release];
    [sortDescriptors release];

    return fetchedResultsController;
}    

Thanks
b00tsy

  • 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-05-16T15:40:04+00:00Added an answer on May 16, 2026 at 3:40 pm

    I think what is going on here is that your SQL store is corrupted and/or you have an unusual sectionNameKeyPath.

    The Core Data schema prefixes all the SQL column names with Z so an error of a name of 'Z suggest a corrupted SQL table. To test for that, execute the fetch request directly instead of using the fetched results controller and see if you can fetch all the objects.

    If you can’t, then the SQL store is corrupted. Most likely, some table component is simply name 'Z instead of something like ZAttributeName. You will have to edit the SQL directly but that is tricky because of the custom private schema. See this post to get an idea what to look for. There are not any tools for doing this because corruption of the store is so rare.

    If the fetch works then the problem is with the sectionNameKeyPath being handed to the fetched results controller. Right now, it looks like you have an entity attribute with the first letter of the title attribute. (This is redundant because by default, the FRC will automatically return alphabetic sections based on any string attribute.) Try changing the sectionNameKeyPath to just the title attribute name (most likely “title”). In any case, just dispense with the uppercaseFirstLetterOfTitle attribute altogether.

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

Sidebar

Related Questions

I have a problem that whenever I'm inserting data using coredata, everything's going fine.
So my problem is that I have a NSManagedObject 'A' which has a has-many
my app has a sqlite database which is already preloaded with data. the database
I have an iPad app that uses Core Data with Sqlite. I keep getting
CoreData beginner I have a simple problem with CoreData. My model has two entities,
I have a sample program that use Core Data and load an sqlite database
I am new on iphone development and I have problem with CoreData. I hardly
I have a bizarre problem with a 'double' property in Core Data. I have
I have a little problem, probably easy for you. Im using Core Data. I
I am having a Core Data problem with NSFetchedResultsController . I have a 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.