JAHelia
JAHelia

Reputation: 7932

Using NSFetchedResultsController and UISearchDisplayController crashes app

I have successfully implemented NSFetchedResultsController and UISearchDisplayController together on my app, the app will crash ONLY after using the UISearchDisplayController (after pressing on its Cancel button), the crash happens exactly while scrolling down the table view, the console shows this message:

Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'no object at index 5 in section at index 0'

giving that scrolling down the table view before using the UISearchDisplayController will not crash the app.

what is the problem reason in this case ?

Upvotes: 0

Views: 656

Answers (1)

Balakrishnan Mca
Balakrishnan Mca

Reputation: 747

I had a similar problem with one of my apps, when the Apple released the new iOS 4.0. Search:

fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:[self managedObjectContext] sectionNameKeyPath:nil cacheName:nil];

And set the value of the parameter cacheName to nil. It worked for me, hope it will for you. It is not necessary to create new fetch result controller each time.

Upvotes: 3

Related Questions