Search code examples
iphoneobjective-cxcodeuitableviewasihttprequest

uitablleview crashes when link datasource


I am calling a view that contains a tableview and is showed properly until I link datsource to file's owner and generates following SIGABRT error. I do not understand what is happening because I had set tableview in other views and works! Problem is same as this thread because I am also using ASIHttprequest:

SIGABRT on startup

 2011-10-13 00:53:36.633 Nimbo[1713:207] -[testViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x5c6fa30
    2011-10-13 00:53:36.639 Nimbo[1713:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[testViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x5c6fa30'
    *** Call stack at first throw:

Solution

  • Have you implemented this method in you viewController:

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    

    Because you are missing this required Delegate method view controller conformed to UITableViewDataSource protocol calls required method on your class since you havent implemented it it crashed. When you compiled your code likely you have gotten this as warning that you havent conformed to this protocol