iOS在UITableViewController里使用UISearchDisplayController报错"[UISearchResultsTableView dequeueReusableCellWithIdentifier:forIndexPath:]"
出现如下错误:
2016-02-13 22:09:22.318 Test[2757:192106] *** Assertion failure in -[UISearchResultsTableView dequeueReusableCellWithIdentifier:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.30.14/UITableView.m:6564
出现这种错误的原因是因为当你点击搜索框的时候, 会出现一个新的UITableViewController, 然后调用UITableViewController的代理方法, 当调用到如下方法时, 就会出错
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cell = tableView.dequeueReusableCellWithIdentifier("reuseIdentifier", forIndexPath: indexPath) cell.textLabel!.text = self.datas[indexPath.section].cities[indexPath.row] return cell
}
因为这里的tableView是UISearchResultsTableView, 当UISearchResultsTableView去内存池中寻找标示为reuseIdentifier的Cell的时候就会出现上面的错误
所以解决方法就是将tableView改为self.tableView即可, 因为self.tableView指的就是UITableViewController中的tableView
iOS在UITableViewController里使用UISearchDisplayController报错"[UISearchResultsTableView dequeueReusableCellWithIdentifier:forIndexPath:]"的更多相关文章
- 安装 r 里的 igraph 报错
转载来源:http://genek.tv/article/40 1186 0 0 安装 r 里的 igraph 报错: foreign-graphml.c: In function ‘igraph_w ...
- [转]html页面调用js文件里的函数报错onclick is not defined处理方法
原文地址:http://blog.csdn.net/ywl570717586/article/details/53130863 今天处理html标签里的onclick功能的时候总是报错:Uncaugh ...
- 解决Flex4在Module里调用PopUpManager报错问题
项目大了 就需要用到Module, 发现在一个Module里边, 和普通应用里一样popup一个组件的时候, 总是会报错. 这个在Flex3的时候也会出现, 会报样式错误 所以就想到了addPopUp ...
- XAMPP里tomcat启动报错:Make sure you have Java JDK or JRE installed and the required ports are free
以前用XAMPP的时候就是自然而然装好了就可以用,最近重装了新系统,打算在Windows 10里面配置Apache tomcat.PHP.MySQL的开发环境,迟迟试验不成功,于是直接用了XAMPP, ...
- AXIS-web.xml里配置axis报错addChild: Child name 'AxisServlet' is not unique 解决办法
报错这个那么就表示,web.xml中有相同的AxisServlet的这个名字,可以把原来的删除配置自己的,也可以保留原来的,自己的不配置 Ctrl+f 搜索下就知道了
- iOS url带中文下载时 报错解决方法
问题描述:下载文件时, 请求带中文的URL的资源时,比如:http://s237.sznews.com/pic/2010/11/23/e4fa5794926548ac953a8a525a23b6f2/ ...
- iOS duplicate symbol 变量 in 类名 报错
该错误信息是我在一个.h文件里申明了公共变量,然后在其他类里重复使用. Build Settings ->No Common Blocks默认为YES,编译器就报错了,需要修改Build Set ...
- post请求(headers里有属性)报错:Request header field xxx is not allowed by Access-Control-Allow-Headers in preflight response
post 请求,headers里有属性(xxx).请求时报错: XMLHttpRequest cannot load <url>. Request header field xxx is ...
- iOS 真机测试的一些报错
1.连了手机热点 fix Issue后出现提示框:No Devices Registered:Creating a provisioning profile requires one or more ...
随机推荐
- C语言初学 简单计算器计算加减乘除程序
#include<stdio.h> main() { float a,b; char c; printf("输入表达式如a+(* - /)b:\n"); scanf( ...
- 用法总结:NSArray,NSSet,NSDictionary-备用
Foundation framework中用于收集cocoa对象(NSObject对象)的三种集合分别是: NSArray 用于对象有序集合(数组)NSSet 用于对象无序集合 (集合)NS ...
- ModelSim仿真入门
ModelSim仿真入门之一:软件介绍 编写这个教程之前,为了让不同水平阶段的人都能阅读,我尽量做到了零基础入门这个目标,所有的操作步骤都经过缜密的思考,做到了详细再详细的程度. 如果您是FPGA开发 ...
- 無心插柳的Linux學習者代言人——蔡德明
誰是「蔡德明」恐怕沒有多少人知道,不過提到「鳥哥」這個稱號,在臺灣的Linux社群幾乎是無人不知無人不曉,蔡德明正是鳥哥的本名.鳥哥究竟多有名? 如果你是有意學習Linux的初學者,卻不知如何下手,1 ...
- VMware虚拟机ping出现DUP!
VMware虚拟机ping出现DUP! ping 外网, 还是ping 网关都出现DUP! 百度查了许久,各种方法都无效,无奈只能google看老外的方法. http://codeblog.co. ...
- jquery创始人
http://developer.51cto.com/art/201102/244898.htm jQuery由美国人John Resig创建,至今已吸引了来自世界各地的众多javascript高手加 ...
- poj3177 Redundant Paths
Description In order to get from one of the F (1 <= F <= 5,000) grazing fields (which are numb ...
- 1346 - Songs (贪心)
John Doe is a famous DJ and, therefore, has the problem of optimizing the placement of songs on his ...
- Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1) 错误 解决方案(android-ndk)
在android里做ndk编程的时候,碰到个随机性错误 错误信息如下: 05-06 15:59:44.411: A/libc(3347): Fatal signal 11 (SIGSEGV) at 0 ...
- Mapreduce运行过程分析(基于Hadoop2.4)——(一)
1 概述 该瞅瞅MapReduce的内部执行原理了,曾经仅仅知道个皮毛,再不搞搞,不然怎么死的都不晓得.下文会以2.4版本号中的WordCount这个经典样例作为分析的切入点.一步步来看里面究竟是个什 ...