简体   繁体   English

XCode 4.6 dequeueReusableCellWithIdentifier:forIndexpath:不起作用

[英]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. 一切都很好,今天我升级到XCode 4.6 ...突然崩溃了。 If there is no data (I'm using Core Data), it will load a blank tableview. 如果没有数据(我正在使用Core Data),它将加载空白表格视图。 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. 我得到“ UITableview:无法识别的选择器...”作为例外。 My class is definitely a subclass of UITableViewController and thus ought to have a tableView, no? 我的类肯定是​​UITableViewController的子类,因此应该有一个tableView,不是吗? When I put the following test code into ViewDidLoad, I don't get confirmation. 将以下测试代码放入ViewDidLoad时,没有得到确认。 In other words, my tableView no longer responds to the method. 换句话说,我的tableView不再响应该方法。 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". 我还尝试将消息发送到“ self.tableview”而不是“ tableview”。 No fix. 没有修复。 Again, this was working fine, I haven't changed anything, just upgraded to 4.6. 再次,这工作正常,我没有做任何更改,只是升级到4.6。 Thanks! 谢谢!

This method was added in iOS 6. Therefore it will not exist in older simulators. 此方法已在iOS 6中添加。因此,在较早的模拟器中将不存在此方法。

You can see when a method was introduced by looking at the docs UITableView 您可以通过查看文档UITableView来了解何时引入方法

Availability 可用性
Available in iOS 6.0 and later. 在iOS 6.0及更高版本中可用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 dequeueReusableCellWithIdentifier forIndexPath - dequeueReusableCellWithIdentifier forIndexPath dequeueReusableCellWithIdentifier:forIndexPath 中的断言失败: - Assertion failure in dequeueReusableCellWithIdentifier:forIndexPath: 何时使用 dequeueReusableCellWithIdentifier 与 dequeueReusableCellWithIdentifier : forIndexPath - When to use dequeueReusableCellWithIdentifier vs dequeueReusableCellWithIdentifier : forIndexPath 如何使用函数dequeueReusableCellWithIdentifier:forIndexPath? - how to use the function dequeueReusableCellWithIdentifier:forIndexPath? 断言失败 - [UITableView dequeueRequeableCellWithIdentifier:forIndexPath:] - Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] 断言失败 - [UITableView dequeueReusableCellWithIdentifier:forIndexPath:]错误 - Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] error Xcode5上的libcurl链接器错误,但在Xcode 4.6上可以正常工作 - libcurl linker error on Xcode5 but working fine on Xcode 4.6 NSMutableArray属性在dequeueReusableCellWithIdentifier中不起作用 - NSMutableArray property is not working in dequeueReusableCellWithIdentifier 使用[tableView dequeueReusableCellWithIdentifier:forIndexPath:]将动作处理程序添加到ios6中单元格中的按钮 - add action handler to button in cell in ios6 using [tableView dequeueReusableCellWithIdentifier:forIndexPath:] XCode 4.6中的生成器和ARC - Mogenerator and ARC in XCode 4.6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM