Not even sure if this is feasible, but here's the use case:
I have a RootView tableview that uses NSFetchedResultsController
to manage the list. I tap an add button, which presents the AdditionViewController
. The AdditionViewController
uses a separatemanagedObjectContext
to create the new object. On Save, the object is passed back to the RootView, where the new object (in the new managedObjectContext
) is merged into the main managedObjectContext
. The AdditionViewController
is then dismissed, revealing the RootView.
What I would like to do, is to push my DetailViewController
with the new object loaded after the merge, so that when the AdditionViewController
is dismissed, the full detail view is revealed.
How can I get the object that has just been added to the fetchedResultsController
in order to pass it to the DetailViewController
?
--UPDATE--
Still nothing on this. Let me try to explain what I need to do (hopefully) a bit better. If this is still confusing, ask questions. I'm having a hard time thinking of how to describe the problem.
I am fully aware how to push the Detail view underneath the modal addition view upon saving the new object. The problem is that the object I am saving is in its own fetchedReaultsController
. I am merging this frc into the main fetchedResultsController
, so if I try to sent the object to the detailview, I get a crash, because the object has been invalidated (due to the merge) by the time the modal addition view is dismissed, and the detailview calls viewWillAppear
. That is what I am trying to get around. How can I figure out what object was just added to the main fetchedResultsController
in order to send it to the detailViewController?
--UPDATE--
Adding a bounty for anyone who can tell me how to retrieve the most recently added object from a fetched results controller. Or how to retrieve a specific object from a fetched results controller without knowing it's indexPath.