I want to manage TableView data sources in the middle of the layout in the UIViewController with the FetchedResultsController, but it does not recognize TableView (see error message below).
2018-10-25 16:01:40.151608 + 0900 Proto 5 ver2 [1101:234061] ***Terminating app due to uncaught exception 'NS InternalInconsistencyException', reason: '-[UITableViewController loadView] instantiated view controller with identifier "testPortal" from storyboard "Main", but didn't get a UITableView.'
I created the view controller with the UIViewController, but later I changed it to the UITableViewController and added NSFetchedResultsControllerDelegate
import UIKit
import CoreData
class TestPortalViewController:UITableViewController, NSFetchedResultsControllerDelegate {
·TableView (taskTableView) is a Storyboard, and I thought they would recognize it, but it doesn't work.
Please advise me if I miss something.
By the way, the same code works for the view controller created with the UITableViewController from the beginning.
Self Answer: The point at which the UITableView and NSFetchedResultsController move in the UIViewController.
The ViewController inherits UITableViewDataSource and NSFetchedResultsControllerDelegate.However, inheritance of UITableViewDelegate is also required for Master-Detail creation.In other words, the only difference from the ViewController that inherits the UITableViewController is whether it is included from the beginning or manually inserted.
Then specify the UITableViews that you want to prepare for the Storyboard as DataSource and Delete.Additionally, connect to the outlet as a ViewController property.
The last name given here is used as the data source name in each implementation of the NSFetchedResultsControllerDelegate protocol.If you use this name as tableView, the DataSource protocol has a method with the same name, which is often confusing.I think it's better to take another name such as footTableView.
That's it
© 2024 OneMinuteCode. All rights reserved.