----------
For the extra credit piece, I'm trying to delete a photo from my table
view using the Edit/Done built-in flow, but my application crashes
with this error message:
Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: 'Invalid update: invalid
number of rows in section 0. The number of rows contained in an
existing section after the update (1) must be equal to the number of
rows contained in that section before the update (1), plus or minus
the number of rows inserted or deleted from that section (0 inserted,
1 deleted).'
when invoking this line of code in the 'commitEditingStyle' method:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:YES];
This method is calling the 'numberOfRowsInSection' method, which calls
the fetchedResultsController to return the number of rows for the
section, but is returning the number of rows prior to the deletion.
----------
when I realized that fetchedResultsController caches its results. So,
before calling the 'deleteRowsAtIndexPaths' method, is the better
practice to call 'performFetch' on fetchedResultsController to refresh
its cache (which works, by the way; no more crashes) or to call its
'deleteCacheWithName' method? Or is there an even better alternative,
as either of these may potentially be expensive operations?
Thanks,
-Jose
On Mar 11, 1:01 am, JoseO <jose.g.oc...@gmail.com> wrote:
> I was just about to post this message:
>
> ----------
> For the extra credit piece, I'm trying todeletea photo from my table
Hope this helps.
Thanks,
jw