转自:http://blog.csdn.net/hamasn/article/details/8613593

Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]

今天做一个tableView遇到一个这么个问题。

经过baidu google,终于找到正解。

因为

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath
这个函数的返回值是个null!!
查stackoverflow 找到下面的解。

CellIdentifier I bet your cellForRowAtIndexPath is returning null.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath
{
static NSString *CellIdentifier = @"Photos"; /** NOTE: This method can return nil so you need to account for that in code */
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; // NOTE: Add some code like this to create a new cell if there are none to reuse
if(cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } NSString *string = [[self.photosInPlace objectAtIndex:indexPath.row] valueForKeyPath:@"description._content"]; cell.textLabel.text = string; return cell;
}

That's probably why [UITableView _configureCellForDisplay:forIndexPath:] is failing... becausecellForRowAtIndexPath is returning a null value and then configureCellForDisplay is expecting aUITableViewCell.

tableView Crash的更多相关文章

  1. Crash以及报错总结

    CoreData: Cannot load NSManagedObjectModel.nil is an illegal URL parameter 这是因为在工程中CoreData的命名和AppDe ...

  2. tableview的重用机制(面试必问)

    iphone重用机制是苹果为了实现大量数据显示而采用的一种节省内存的机制,比如在UITableView和ScrollView 等地方.为什么要“可重用”???对于我们的项目来说,内存控制是必不可少的, ...

  3. iOS:项目中疑难Crash问题集锦

    项目中疑难Crash问题集锦 iOS App运行中遇到Crash的情况相信大家都遇到过,开发和者测试中遇到了可能很方便的办法就是直接拿着设备连接一下,然后使用Xcode自带的工具就可以解析出Crash ...

  4. iOS 数组越界 Crash加工经验

    我们先来看看有可能会出现的数组越界Crash的地方. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSInd ...

  5. UITableView.m:8042 crash 崩溃

     CRASH : /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.6.21/UITableView.m:804 ...

  6. iOS开发笔记之TableView优化

    TableView相信只要是做iOS开发的就不会陌生,目前大多数iOS的app都是采用TabBar+NavigationBar+TableViewController这一主流框架, 既然用的这么频繁, ...

  7. tableview的reloadData应注意

    http://blog.csdn.net/ouyangtianhan/article/details/7835041 http://stackoverflow.com/questions/160715 ...

  8. iOS.Crash.OniOS8.WhenCall[popToRootViewController]

    系统iOS 8.x, ARC. CrashCase: 在UIViewController中有一个类型为UIScrollView的实例变量scrollView, 点击UIViewController中的 ...

  9. 关于tableview下拉刷新崩溃的问题

    逻辑应该是这样的:1. 下拉2. 达到下拉临界值以后再请求网络数据3. 待数据加载到本地以后才更新 data source4. reload tableview 如果先清空再下拉,后果就是往下拉的距离 ...

随机推荐

  1. SharePoint 软件边界及限制

    摘自technet http://technet.microsoft.com/zh-cn/library/cc262787.aspx

  2. Qt之模型/视图(自定义按钮)(使用QStyleOption的子类进行drawControl,和我用的方法完全不一样)

    http://blog.csdn.net/liang19890820/article/details/50974059

  3. linux 发布 qt(更新ld命令的路径依赖)

    PATH 错误解决error while loading shared libraries: libXXX.so.X: cannot open shared object file: No such ...

  4. Spring基础介绍

    Spring属于轻量级还是重量级框架?   这需针对使用Spring的功能而言,比如我们常使用其核心服务整合SSH,这样则为轻量级. 如果使用其大部分服务则可以理解为重量级.   普通JAVA项目环境 ...

  5. 9.DataPager

    ListView搭配DataPager控件实现分页.有两种使用方式:一是将DataPager声明到ListView中:一种是DataPager\ListView没有嵌套关系,然后将DataPager的 ...

  6. 常用的用户状态命令包括:whoami、id、groups、newgrp 等

    用户状态命令 常用的用户状态命令包括:whoami.id.groups.newgrp 等.

  7. PHP实现登录,注册,密码修改

    注册,登录,修改密码 1.登录 2.忘记密码 3.免费注册 页面布局 <div id="views" class="views"> <div ...

  8. 【效率】FIND

    文档 HTML Flash CSS 字体 命名颜色 工具 IMG

  9. JavaScript 调试常见报错以及修复方法

    (看到一篇调试JS很有用的文章,收藏一下) JavaScript 调试是一场噩梦:首先给出的错误非常难以理解,其次给出的行号不总有帮助.有个查找错误含义,及修复措施的列表,是不是很有用? 以下是奇怪的 ...

  10. UVALive 5990 Array Diversit

    题意:对于一个数列A,substring是一个连续子串,subsequence是其非连续子序列.对于一个数字序列,记它的diversity是它的最大元素减去最小元素的差.给出一个数字序列,求与它div ...