I'm using CoreData for the first time, and trying to figure out how to populate a TableView using it. I have seen the sample code Apple provides, but get confused here:
NSManagedObjectContext *moc = …; //Retrieve the main queue NSManagedObjectContext
How do I retrieve the main queue NSManagedObjectContext? I've seen some say get it from AppDelegate, and I've seen others say that's not the correct way to do it, and Apple doesn't seem to use either method, and for some unknown reason just decides to omit code.
You can try using NSFetchedResultsController
here is a complete tutorial that features it with tableView
Swift : NSFetchedResultsController
Objective-C : NSFetchedResultsController & NSFetchedResultsController
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.