简体   繁体   中英

XCode 4.6 dequeueReusableCellWithIdentifier: forIndexpath: not working

I've been working on this project for a while. Everything was fine, and today I upgraded to XCode 4.6...all of a sudden, crash. If there is no data (I'm using Core Data), it will load a blank tableview. As soon as I try to add something in my other view controller, crash. Same issue on the simulator and on my device. With "All Exceptions" breakpoint enabled, the debugger is pointing to this line:

    ReedCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

I get "UITableview: unrecognized selector..." as the exception. My class is definitely a subclass of UITableViewController and thus ought to have a tableView, no? When I put the following test code into ViewDidLoad, I don't get confirmation. In other words, my tableView no longer responds to the method. What the heck? If it was deprecated, I don't see any documentation of that.

if ([self.tableview respondsToSelector:@selector(dequeueReusableCellWithIdentifier:forIndexPath:)]) {
    NSLog(@"RTVC responds to selector dequeueReusableCellWithIdentifier:forIndexPath:");
}

I've done cleans, deleted it from the simulator, checked that the view controller in the storyboard is still the correct class (it is). I also tried sending the message to "self.tableview" instead of "tableview". No fix. Again, this was working fine, I haven't changed anything, just upgraded to 4.6. Thanks!

This method was added in iOS 6. Therefore it will not exist in older simulators.

You can see when a method was introduced by looking at the docs UITableView

Availability
Available in iOS 6.0 and later.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM