Reason "source data source not installed" error in iOS 8.0.2

I have a view that has a table for displaying a list of contacts and another view for its details. The problem is when I open the contact view, then it works fine; but when I open it, go to the detailed view of the contact and click, then it will fail. It shows me an error as shown below.

Confirmation error in - [UITableView _createPreparedCellForGlobalRow: withIndexPath:], / SourceCache / UIKit_Sim / UIKit-1914.84 / UITableView.m: 6048.
Application termination due to the uncaught exception "NSInternalInconsistencyException", reason: "UITableView dataSource not set"

I watched this in iOS 8.0.2, which works fine on iOS 7.0. Is there anything related to the iOS version.?

The same thing happens in the message module. Here I place the code snippet.

MessageListController.m

- (void)viewDidLoad { [super viewDidLoad]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:YES]; self.tabBarController.tabBar.hidden = FALSE; instanceMessageList.delegate = self; instanceMessageList.dataSource = self; [self setNavigationBarView]; } - (void)viewDidUnload { [super viewDidUnload]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self setEditing:FALSE animated:YES]; } - (void)dealloc { [instanceMessageList release]; [super dealloc]; } 

MessageListViewController.h

 @interface MessageListViewController : UIViewController <UITableViewDelegate, UITableViewDataSource,NSFetchedResultsControllerDelegate, MessageDelegate, UIActionSheetDelegate> { #pragma mark - #pragma mark Instance variable declaration IBOutlet UITableView *instanceMessageList; IBOutlet UILabel *noMessages; } #pragma mark - #pragma mark Instance variable property declaration @property (nonatomic, retain) UITableView *instanceMessageList; @end 
+6
source share
2 answers

Got a solution. There is no actual error in the above code. The error occurs during detailed viewing in the viewWillDisappear () method.
The root reason: when you press the back button, the keyboard is hidden, which leads to the fact that the UITableView executes the CellForRowAtIndexPath () method, and at the same time in the ViewWillDisappear () method I set the datasource to nil table. that caused the error.

+1
source

Obviously, the view is reloading and the data source is upset somewhere. Inside your -viewDidLoad contact -viewDidLoad add the following code:

 self.tableView.dataSource = self; self.tableView.delegate = self; 
0
source

Source: https://habr.com/ru/post/976092/


All Articles