NSFetchedResultsController: Mehrere FRCs, Fehler beim Aktualisieren delegieren

Zielsetzung: Sortieren Sie mit FRCSection's durchstartDate, einNSDate Attribut, aber wollenTodayDatumSection vorher erscheinenUpcoming TermineSection.

Ich habe Apples Code mit einer vorübergehenden Eigenschaft verfolgtsectionIdentifier. Apples Beispielcode. und begann mit diesem Projekt zuerst:OneFRC

Ich stellte schnell fest, dass dies möglicherweise nicht mit nur einem FRC möglich ist (ich könnte mich irren).

Als nächstes habe ich mich entschlossen, dies mit 3 FRCs zu versuchen: ThreeFRC.

Tabellenansichtsections Jetzt erscheint in der Reihenfolge, die ich möchte:

Abschnitt 0:Today

Abschnitt 1:Upcoming

Sektion 2:Past

Das Hinzufügen von Daten löst jedoch FRC-Delegaten aus, und es wird die folgende Fehlermeldung angezeigt:

CoreData: error: Serious application error.  An exception was caught from the 
delegate of NSFetchedResultsController during a call to 
-controllerDidChangeContent:.  Invalid update: invalid number of rows in section 0.
The number of rows contained in an existing section after the update (4) must be 
equal to the number of rows contained in that section before the update (3), plus 
or minus the number of rows inserted or deleted from that section (0 inserted, 
0 deleted) and plus or minus the number of rows moved into or out of that section 
(0 moved in, 0 moved out). with userInfo (null)

Auch hier würde ich gerne in der Lage sein, mein Ziel mit 1 FRC zu erreichen, aber ich kann nicht herausfinden, wie.

Ich habe versucht, dies für 4 Tage jetzt zu lösen! Wenn dieses Problem in SO nicht behoben wird, kann ich möglicherweise den Support von Apple für Entwickler in Anspruch nehmen. Und in dem Fall, dass ich es tue, werde ich die Entschließung hier veröffentlichen, damit andere davon profitieren können.

Projekte sind auf Github verfügbar:

Ein FRC

Drei FRC

BEARBEITEN

Dank @blazejmar konnte ich das loswerdenrows Error. Jetzt erhalte ich jedoch eine Fehlermeldung, wenn ich versuche hinzuzufügensections.

2014-11-03 16:39:46.852 FRC[64305:60b] CoreData: error: Serious application error.  
An exception was caught from the delegate of NSFetchedResultsController during a 
call to -controllerDidChangeContent:.  Invalid update: invalid number of sections.  
The number of sections contained in the table view after the update (2) must be 
equal to the number of sections contained in the table view before the update (1), 
plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted). 
with userInfo (null)

Schritte zum Reproduzieren des Fehlers in drei FRC:

1. Launch App -> 
2. Tap Generate Data -> 
3. Tap View in FRC -> 
4. Tap back to the RootVC ->
5. Change the system date to a month from Today -> 
6. Tap View in FRC and only one section `Past` should appear. -> 
7. Tap `Add Data`.  
8. The error should appear in the log. 

Antworten auf die Frage(2)

Ihre Antwort auf die Frage