转自: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. Unity OF 3DMax毛坯房制作标准

    Unity OF 3DMax毛坯房制作标准 1.模型 2.贴图 3.模型塌陷展UV 4.灯光 5.Radiosity 6.Render  To   Texture 7.烘焙 8.导出 1.模型回目录 ...

  2. sql server更改机器名后更改数据库机器名

    方式一: 本地机器名查询: select * from sys.servers 修改机器名: sp_dropserver 'old server name' sp_addserver 'new ser ...

  3. 延长FLASH和EEPROM芯片写入次数的小方法

    开发电子产品时,常常需要断电后保存某些数据,这就需要使用 FLASH或EEPROM芯片,这两种芯片,可擦除的次数是有限制的,通常FLASH为10万次,EEPROM要多一点,为100万甚至1000万次. ...

  4. Delphi 和 DFM

    Delphi et les DFM Depuis la toute première version de Delphi, celui-ci intègre des fichiers à l'exte ...

  5. osg

    智能指针使用: osg::Geode* geode=new osg::Geode;//新建Geode指针 osg::ref_ptr<osg::Geode>geodePtr=geode;// ...

  6. vtk 导出结果图片

    项目中需要将渲染结果导出为图片. (1)  一开始搜了vtk的方法,发现: http://blog.csdn.net/lbluekey/article/details/3346312 http://w ...

  7. 动态规划——B 最大高度问题

    B - LIS Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Stat ...

  8. 从git上下载代码并导入eclipse

    主要分为两步: 1.先从git下载代码到本地git仓库 2.eclipse import导入存在的maven项目

  9. DNA repair - HDU 2457(自动机+dp)

    题目大意:给你N个DNA的串,也就是至包含'A','T','G','C'四种碱基的,这些给定的串都是带有遗传病的,然后给你一个不会超过1000的串,问你至少几个地方才能让这个串不包含遗传病,如果不论怎 ...

  10. Best Reward HDU 3613(回文子串Manacher)

    题目大意:有一个串(全部由小写字母组成),现在要把它分成两部分,如果分开后的部分是回文串就计算出来它的价值总和,如果不是回文的那么价值就是0,最多能得到的最大价值.   分析:首先的明白这个最大价值有 ...