Is it safe to assume that an attribute, namely fetchedResultsController, of chatViewController, an instance of a subclass of UITableViewController, is always nil when viewDidLoad is called, assuming that it’s set to nil in viewDidUnload? Phew!
If that’s the case, then I see no immediate need to redefine the accessor function like in the Xcode example application CoreDataBooks. I’d rather just put all that code in viewDidLoad instead of in a separate function because that’s the only place I’ll use it.
viewDidLoad is called after your view is loaded. Whether or not fetchedResultsController is nil or not depends on how the viewController is initialized. For example, when creating the
detailViewController, you could set itsfetchedViewControllerbeforeviewDidLoadis called:That said, then nil’ing fetchedResultsController in viewDidUnload would ensure that it’s nil.