I have a SplitViewController with a rootViewController tableview and a detailView tableview.
The rootViewController contains objects which contain objects in the DetailViewController. If there are no objects in the rootViewController objects then the rootViewController object is removed.
e.g. One Story contains Many Sentences
If you have a Story selected, and you delete the last sentence it contains in the detailViewController – what should you do to the detailViewController? The story is successfully removed from the rootviewcontroller, but I’m not sure what to do in the detailViewController. In an iPhone specific app I would just pop back the navigation controller from sentences to stories, but I’m not sure what to do when the detailViewController is always visible as it is with a svc.
I’ve tried:
- Setting the detailViewController as a blank tableview
- Setting the current story object as blank
If I choose to do nothing, I get an CoreData exception:
CoreData: error: Serious application error. An exception was caught
from the delegate of NSFetchedResultsController during a call to
-controllerDidChangeContent:. attempt to insert row 7 into section 0, but there are only 1 rows in section 0 after the update with userInfo
(null)
Make sure your master view controller can handle an empty list and load a new detail view controller with a label in the middle saying something like “No items”.
Try creating a new folder (“mailbox”) in Mail and going into it.
Alternatively, if deleting everything means it’s not useful to show an empty list, you can also automatically pop to the previous navigation level.