I'm now reading this great tutorial on which an author explains how to connect view controller to app delegate using .xib
file (on section 11) in order to use Core Data in different view controllers. Unfortunately, the post was written in 2011 and quite outdated since the .xib
is no more available in Xcode 5 and replaced with storyboard.
With a quick search, I found how to connect AppDelegate to view controller from within storyboard, by using storyboard unique identifier of the view controller on identify inspector pane. However, I wonder whether it is necessary to make such connection in the appdelegate in the current developing environment (Xcode 5 and iOS 7), since I don't have any issues whatsoever even if I don't bother doing such connection - all I did was import the view controller in AppDelegate.h
and declared its instance as property (i.e. @property (strong, nonatomic) MyViewController *myViewController;
) and finally connect managedObjectContext
between the two object, and hence I didn't even declare it as IBOutlet
, as explained by the author of the above post.
I've run the simulator with it and I've not encountered any issues so far. However, the "so far" means all that I've written is the connection of the view controller's managedObjectContext
to that of App Delegate's, and I wonder whether it has to be connected as IBOutlet
from within storyboard to make more convoluted implementation going forward, including insertion and deletion of managed objects or the connection of table view to NSFetchedResultsController
.
So could anyone teach me about which way I should take? And if it doesn't have to be connected explicitly, then why was it needed in the older version but not now?