iphone - Why is NSFetchedResultsController not correctly loading section titles? -


I am using NSFetchedResultsController with a UITableViewController.

I have created a transient field in my core, the name of the data model area to use as a label for my UITableView sections is "section index" in my application, in a "client" unit There are many "jobs" (many more than 1) - so to get my related job groups known by their respective "client" (through section).

I apply this method to my code base as a category on the 'job' unit

  @implementation job (TransientMethods) - (NSString *) sectionIndex {NSLog ( @ "JobWrapper.Job.sectionIndex .:% @", Self.client.name); Return self.clit.name; } @end  

and the string "sectionIndex" sectionNameKeyPath as the argument is sent in the init method for NSFetchedResultsController

I wipe the app from the simulator - The application runs for the first time, the job of the job retrieves the front page correctly and lists jobs according to the section index method by the job client name. In logs, I can really see that this section is applied several times.

However, do not apply the sectionindex method after the application ... and yet, segment labels are still shown with values, how is this going through the last run? Is there some magic caching in the middle of the run?

This behavior then leads to a major problem, by looking at UITableView if I release it with a different predicate and alloc NSFetchedResultsController and if the result set is the same size, then this same, Original section name show new results for all!

And of course, there are no new log entries. This means that the columns are never seen, which means that the code never invites or transient areas are visible. It seems that there is no mistake in those areas.

Now, if the optional query returns a different number of results, the class names are loaded ie IE: in that case, showing logs - each time the button is pushed on - the 'section index' method is being applied And the label shown in the UiTable view.

It's crazy - if I have 2 buttons for "active" jobs and 2 "inactive" jobs and I have to switch back and forth between related questions ... then All the sections that were related to the initial query were labeled for subsequent table views.

It seems that the section Name Name KF field is implemented by FetchedResultsController only when the result results in different # results? Actual results are different - In real time, job names are displayed correctly - but again, I do not think section labels are making a mistake or are asking the NSFetchedResultsController correctly for the section label. (UITableView *) tableView titleForHeaderInSection:; (NSInteger) section {integer count = [[results_ squared] counting] - (NSString *) tableView

 : If I'm using the following (calculation> section) {id & lt ; NSFetchedResultsSectionInfo & gt; SectionInfo = [[results_ classes] objectAtIndex: section]; Return [section info name]; } Return zero; }  

Where the result is the NSFetchedResultsController that I am creating for each query.

Am I missing something? Is there a way to manually clean core data caches, which makes it very smart and on every query, is definitely visible to sectionNameKeyPath?

For its price, I ignored the "transient" option field in Xcdatamodel but I'm getting the same results.

One of the fundamental reasons for this is that when I make the first job as the first activation (not the default startup scene) - if I also stick to both an active work ... passive section label Also, when I close the application and start ... the inactive section label still shows - However, on the title screen, I am displaying active tasks that appear completely different labels Should be given.

I do not think this core data is a problem, it does not make sense that the restart of the application is awkward back to the data.

per comment, I set cacheName not equal to:

  results_ = [[NSFetchedResultsController alloc] initWithFetchRequest: fetchRequest managedObjectContext: context_ sectionNameKeyPath: @ "sectionIndex" cacheName: zero];  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -