- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个简单的 UITableviewController ,以前工作正常,但现在有些东西破坏了它。它提供了一个简单的表单,允许我向核心数据管理对象添加一个简单的 3 字段记录。
当我添加一条记录时,它应该返回到表并显示内容。我可以看到它正在将记录写入数据库,但表是空的并且出现以下错误。我可以通过单击“添加”按钮继续添加记录,但每次保存新记录并返回表时,它都是空的。
我看到的完整错误是这样的..
*** Assertion failure in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:], /SourceCache/UIKit_Sim/UIKit-1448.89/UITableView.m:5678
2011-10-01 22:48:11.860 Gradetrack[59617:207] Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath: with userInfo (null)
如果我停止模拟器并重新启动它,我可以从 NSLog 语句中看到它已从数据库中发现了正确数量的记录并已尝试加载表,但此时,我收到类似的错误和下面的堆栈跟踪。
2011-10-01 23:08:50.332 Gradetrack[59795:207] >>> Enumber of courses entered thus far: 4
2011-10-01 23:08:50.334 Gradetrack[59795:207] *** Assertion failure in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:], /SourceCache/UIKit_Sim/UIKit-1448.89/UITableView.m:5678
2011-10-01 23:08:50.337 Gradetrack[59795:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
*** Call stack at first throw:
(
0 CoreFoundation 0x00fd05a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01124313 objc_exception_throw + 44
2 CoreFoundation 0x00f88ef8 +[NSException raise:format:arguments:] + 136
3 Foundation 0x000e43bb -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x0035ec91 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 883
5 UIKit 0x003544cc -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 75
6 UIKit 0x003698cc -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1561
7 UIKit 0x0036190c -[UITableView layoutSubviews] + 242
8 QuartzCore 0x01f70a5a -[CALayer layoutSublayers] + 181
9 QuartzCore 0x01f72ddc CALayerLayoutIfNeeded + 220
10 QuartzCore 0x01f180b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
11 QuartzCore 0x01f19294 _ZN2CA11Transaction6commitEv + 292
12 UIKit 0x002eb9c9 -[UIApplication _reportAppLaunchFinished] + 39
13 UIKit 0x002ebe83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690
14 UIKit 0x002f6617 -[UIApplication handleEvent:withNewEvent:] + 1533
15 UIKit 0x002eeabf -[UIApplication sendEvent:] + 71
16 UIKit 0x002f3f2e _UIApplicationHandleEvent + 7576
17 GraphicsServices 0x01928992 PurpleEventCallback + 1550
18 CoreFoundation 0x00fb1944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
19 CoreFoundation 0x00f11cf7 __CFRunLoopDoSource1 + 215
20 CoreFoundation 0x00f0ef83 __CFRunLoopRun + 979
21 CoreFoundation 0x00f0e840 CFRunLoopRunSpecific + 208
22 CoreFoundation 0x00f0e761 CFRunLoopRunInMode + 97
23 UIKit 0x002eb7d2 -[UIApplication _run] + 623
24 UIKit 0x002f7c93 UIApplicationMain + 1160
25 Gradetrack 0x00002034 main + 102
26 Gradetrack 0x00001fc5 start + 53
根据 NSLog 语句,这是最后执行的子例程。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
NSLog(@">>> Enteringg %s [Line %d] ", __PRETTY_FUNCTION__, __LINE__);
id <NSFetchedResultsSectionInfo> sectionInfo =
[[_fetchedResultsController sections] objectAtIndex:section];
NSLog(@">>> Enumber of courses entered thus far: %d ", [sectionInfo numberOfObjects]);
return [sectionInfo numberOfObjects];
}
注意:到目前为止输入的类(class)数的输出...是 4,这是正确的。
这是我将单元格返回到 UITableViewController 的地方
- (UITableViewCell *)tableView:(UITableView *)tableView atIndexPath:(NSIndexPath *)indexPath {
NSLog(@">>> Entering %s [Line %d] ", __PRETTY_FUNCTION__, __LINE__);
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell =
[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
[tableView setAllowsSelectionDuringEditing:NO];
[self configureCell:cell atIndexPath:indexPath];
// load the cell with an appropriate image
NSString *path = [[NSBundle mainBundle] pathForResource:@"studentprofile" ofType:@"png"];
UIImage *theImage = [UIImage imageWithContentsOfFile:path];
cell.imageView.image = theImage;
return cell;
}
根据这些错误和我的堆栈跟踪,任何人都可以指出我正确的方向吗?
非常感谢,
菲尔
最佳答案
我刚刚遇到了同样的问题,但我不小心声明了:
<UITableViewDelegate, UITableViewDelegate>
而不是正确的:
<UITableViewDelegate, UITableViewDataSource>
乔
*更新 - 我还注意到在 xCode 4.3 中,创建新的 UITableViewController 类时生成的模板缺少 cellForRowAtIndexPath 中的关键项。即:
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
关于iphone - 尝试调试错误: *** Assertion failure in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7624415/
应用程序在模拟器上运行良好,但我无法在我的设备(小米 Mi4)上启动应用程序。起初我用这样的文字播种对话: Installation failed with message Failed to est
尽管使用了唯一的模块名称(例如 THIS 不是手头的问题),但在 kadena 的测试网上部署我的智能合约失败并显示以下错误消息: : Failure: Tx Failed: Keyset failu
简而言之 - 我正在尝试从 plist 中获得高分 这是读取数据的代码: var myOutput: AnyObject? = NSUserDefaults.standardUserDefau
在 Xcode(7.2 和 7.3) 中进行 UI 测试时,我的测试有时会失败并出现相当一般性的错误: Assertion Failure: UI Testing Failure - Failure
我正在尝试向 BizTalk 发送 HL7 消息并收到错误代码 0xC0C01B4e(路由失败报告)和消息: Routing Failure Report for 我已经在最后一天工作了,现在收到这
我对 scrapy 还很陌生,我正在尝试使用一些代理来抓取一些 craigslist 页面,但我收到了一些错误,如下所示。我尝试了命令 scrapy shell "https://craigslist
我正在尝试使用来自服务器的给定链接使用 URL 类下载一些内容。 我要下载的代码是: URL url = new URL(downloadUrl); I
我正在做一个数据抓取项目,我的代码使用了 Scrapy(版本 1.0.4)和 Selenium(版本 2.47.1). from scrapy import Spider from scrapy.se
我正在设置 ADF 管道以将 blob 复制到 Azure SQL DB。我的管道中有一个迭代事件,其中我设置了一个计数器,仅当 blob 存在时才进行循环和复制。 除了一些随机的 PK 违规之外,这
我正在设置 ADF 管道以将 blob 复制到 Azure SQL DB。我的管道中有一个迭代事件,其中我设置了一个计数器,仅当 blob 存在时才进行循环和复制。 除了一些随机的 PK 违规之外,这
如果 junit 测试的结果为“失败”,这到底意味着什么?我假设测试期间发生了异常,但我找不到任何有关它的信息。失败跟踪中的行也是: Assert.assertTrue(result); 其中结果只是
我正在制作这个控制台应用程序,用户必须在其中输入内容。然而,当代码到达用户输入文件名的部分,然后使用 strcat 将其添加到文件路径中时,它会输出段错误。完整代码如下: int main(int a
如何解决这个问题?命令 ionic cordova 构建 android 失败:构建因异常而失败。 出了什么问题: 无法启动守护进程。此问题可能是由于守护程序配置不正确造成的。例如,使用了无法识别的
当我尝试在我的设备而不是 Android 虚拟设备上运行应用程序时,它给出错误并停止运行。 在控制台上显示这些消息。 打开:权限被拒绝 pkg:/data/local/tmp/com.example.
今天我下载了 Android Studio v 0.8.0 beta。我正在尝试在 SDK 17 上测试我的应用程序。 Android Studio 错误 Failure [INSTALL_FAILE
我使用 Meizu MX6 在 Android Studio 上工作。以前一切正常。但似乎在更新 Flyme 之后,我开始遇到这个问题: Failure [INSTALL_FAILED_USER_RE
这个问题在这里已经有了答案: List[Try[T]] to Try[List[T]] in Scala (4 个答案) 关闭 2 年前。 如果我有一些验证函数: def validateOne(a
我安装了 Docker 版本“Docker 版本 19.03.8,构建 afacb8b”,当我尝试使用 docker pull 命令时,如“docker pull mcr.microsoft.com/
我正在Xcode 11上构建SwiftUI应用程序,但是当我切换到应用程序中的特定选项卡时,它会立即终止。 问题是,它始终指向Application Delegate文件,我认为这并不是真正的问题。我
所以我这里有一个 Azure 机器学习管道,它由许多 PythonScriptStep 任务组成 - 确实非常基本。 由于网络问题或其他问题,其中一些脚本步骤会间歇性失败 - 确实没有什么意外。这里的
我是一名优秀的程序员,十分优秀!