[Solved] Refactoring UITableView delegates for iOS7 and iOS8


self.tableView setDelegate: assigns a weak reference; if you don’t hold your own reference to this object, it will get collected. This is why you’re seeing the crash. The system has collected the memory that was assigned to your delegate, then reassigned the memory to an NSArray. Your table tries to call methods on the delegate and can’t because NSArray does not respond to them.

Alongside the self.tableView property definition, define another property:

@property (strong) id<UITableViewDelegate> myTableViewDelegate;

3

solved Refactoring UITableView delegates for iOS7 and iOS8