You are currently viewing the BOOK: Professional iPhone and iPad Database Application Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
Chapter 7 - Fatal Error when tapping Hi-Pri button
The app in chapter 7, as coded by the book and also in the downloaded code, crashes when you tap the Hi-Pri button with this console output:
FATAL ERROR: The persistent cache of section information does not match the current configuration. You have illegally mutated the NSFetchedResultsController's fetch request, its predicate, or its sort descriptor without either disabling caching or using +deleteCacheWithName:
Thanks again Bob! I had figured it out by looking up deleteCacheWithName: as explained in the error, just hadn't come back here yet to post it yet. And actually, you have to add that line of code to toolbarFilterAll: as well.
Last edited by scottgardner; April 30th, 2011 at 07:46 PM.
It seems to work if I disable caching altogether by setting the Cache: parameter to NIL instead of @"Root". in
NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:nil];
but this still leaves the questions as to how to make cache functionable?
I am having the same problem as haze1021. Implementing the solution suggested by thepianoguy workes the first time i build the application but after i rebuild the application i get the FATAL ERROR message.
I have set the cacheName to nil and the application works.
Please can someone clarify how to make cache useful?
I don't actually have the book (though having responded to posts in this forum so often, I am thinking I should actually go through it!) The solution I proposed works fine with the downloaded source code. I have been unable to make it crash. Some of the issues with the project came about due to changes in the implementation of CoreData from iOS 3 to iOS 4, and also due to the introduction of multitasking and apps going to the background rather than terminating in iOS 4, since the projects were originally written in iOS 3.1.x or 3.2. I may pick up a copy of the book and do the project in iOS 5 to sort out the problem you are having. It doesn't make sense to have to delete the cache upon starting the app. That should be cleanup, not initialization.
Another thing that should be done is that the code in the applicationWillTerminate… method should be moved to the applicationDidEnterBackground… method since the applicationWillTerminate will rarely, if ever, be called. From the applicationDidFinishLauching… signature you provided it appears that you did the program in iOS 5. Without having a copy of the book I don't know whether the downloaded projects have any discrepancies with the code as presented in the text, so just creating an iOS 5 project and copying the code from the download may or may not result in something comparable to what you have. It will be a couple of days before I can get my hands on a copy of the book.
Did you make any other changes to the program?
Would you mind sending a copy of your project for me to take a look at, and maybe I can see how it differs from the download that has been working for me?