编辑:我找到了解决方案,这里是答案:
UITableViewCell indexPath crash in iOS7
谢谢!
我在模拟器 7.0 上使用 Xcode 5.1.1。 当我启动我的应用程序时,我遇到了一个导致我的应用程序崩溃的错误。 这是错误消息:
2014-04-28 15:06:45.144 OpenSeriesMercedesFrance[7817:70b] -[UITableViewWrapperView cellForRowAtIndexPath:]: unrecognized selector sent to instance 0xadcce00
2014-04-28 15:06:45.146 OpenSeriesMercedesFrance[7817:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewWrapperView cellForRowAtIndexPath:]: unrecognized selector sent to instance 0xadcce00'
*** First throw call stack:
(
0 CoreFoundation 0x03a085e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x02fbe8b6 objc_exception_throw + 44
2 CoreFoundation 0x03aa5903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x039f890b ___forwarding___ + 1019
4 CoreFoundation 0x039f84ee _CF_forwarding_prep_0 + 14
5 OpenSeriesMercedesFrance 0x000524b2 +[Rules changeCell:atIndexPath:forRow:inSection:inFormDictionary:] + 354
6 OpenSeriesMercedesFrance 0x00051cdf +[Rules checkRule:atIndexPath:inFormDictionary:] + 911
7 OpenSeriesMercedesFrance 0x00154a8d -[MainViewController showFormScrollView] + 861
8 OpenSeriesMercedesFrance 0x00158986 -[MainViewController countrySelected:isDefaultCountry:] + 582
9 OpenSeriesMercedesFrance 0x00137055 -[CountryTableViewController tableView:didSelectRowAtIndexPath:] + 565
10 UIKit 0x00db77b1 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1513
11 UIKit 0x00db7924 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 279
12 UIKit 0x00dbb908 __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
13 UIKit 0x00cf2183 ___afterCACommitHandler_block_invoke + 15
14 UIKit 0x00cf212e _applyBlockToCFArrayCopiedToStack + 403
15 UIKit 0x00cf1f5a _afterCACommitHandler + 532
16 CoreFoundation 0x039d04ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
17 CoreFoundation 0x039d041f __CFRunLoopDoObservers + 399
18 CoreFoundation 0x039ae344 __CFRunLoopRun + 1076
19 CoreFoundation 0x039adac3 CFRunLoopRunSpecific + 467
20 CoreFoundation 0x039ad8db CFRunLoopRunInMode + 123
21 GraphicsServices 0x03c959e2 GSEventRunModal + 192
22 GraphicsServices 0x03c95809 GSEventRun + 104
23 UIKit 0x00cd5d3b UIApplicationMain + 1225
24 OpenSeriesMercedesFrance 0x00029b7d main + 125
25 libdyld.dylib 0x0355a701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
我真的不明白那个消息。当我查看其他消息时(当我用谷歌搜索时,我发现一些人有相同类型的问题,他们说要查看连接检查器。可能有一个按钮已被删除,但我什么也看不到...)。
最佳答案
您设置为 tableView 委托(delegate)的类未实现 cellForRowAtIndexPath: 方法 - 这是必需的。
尝试使用默认值(将其添加到您创建表的类中):
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
return cell;
}
关于ios - 启动我的应用程序时出现错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23343099/