当我将插座连接到故事板时,似乎会出现此问题。如果我没有连接它们,我可以运行应用程序并运行 - 无需在表格中显示任何内容。但是,连接插座时会出现错误。
2014-11-19 15:35:45.477 To Do 2[2786:34838] -[To_Do_2.FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7b660fd0
2014-11-19 15:35:45.488 To Do 2[2786:34838] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[To_Do_2.FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7b660fd0'
*** First throw call stack:
(
0 CoreFoundation 0x00212946 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x01beea97 objc_exception_throw + 44
2 CoreFoundation 0x0021a5c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x001633e7 ___forwarding___ + 1047
4 CoreFoundation 0x00162fae _CF_forwarding_prep_0 + 14
5 UIKit 0x00d0237f -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 2803
6 UIKit 0x00d0673a -[UITableViewRowData numberOfRows] + 98
7 UIKit 0x00b31650 -[UITableView noteNumberOfRowsChanged] + 175
8 UIKit 0x00b30b79 -[UITableView reloadData] + 1782
9 UIKit 0x00b3532e -[UITableView _reloadDataIfNeeded] + 78
10 UIKit 0x00b3b317 -[UITableView layoutSubviews] + 36
11 UIKit 0x00ab0dd1 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 608
12 libobjc.A.dylib 0x01c04771 -[NSObject performSelector:withObject:] + 70
13 QuartzCore 0x0469c28f -[CALayer layoutSublayers] + 152
14 QuartzCore 0x04690115 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 397
15 QuartzCore 0x0469e5f6 -[CALayer(CALayerPrivate) layoutBelowIfNeeded] + 44
16 UIKit 0x00aa2d52 -[UIView(Hierarchy) layoutBelowIfNeeded] + 710
17 UIKit 0x00aa2a77 -[UIView(Hierarchy) layoutIfNeeded] + 83
18 UIKit 0x00bc32a6 -[UITabBarController _layoutViewController:] + 312
19 UIKit 0x00bc3451 -[UITabBarController _wrapperViewForViewController:] + 248
20 UIKit 0x00bcb43e -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 454
21 UIKit 0x00bcaa62 -[UITabBarController transitionFromViewController:toViewController:] + 64
22 UIKit 0x00bc6c55 -[UITabBarController _setSelectedViewController:] + 340
23 UIKit 0x00bc6ad7 -[UITabBarController setSelectedViewController:] + 193
24 UIKit 0x00bc36a2 __87-[UITabBarController _selectDefaultViewControllerIfNecessaryWithAppearanceTransitions:]_block_invoke + 43
25 UIKit 0x00aa77af +[UIView(Animation) performWithoutAnimation:] + 82
26 UIKit 0x00bc354f -[UITabBarController _selectDefaultViewControllerIfNecessaryWithAppearanceTransitions:] + 244
27 UIKit 0x00bc43a6 -[UITabBarController viewWillAppear:] + 148
28 UIKit 0x00b816e1 -[UIViewController _setViewAppearState:isAnimating:] + 545
29 UIKit 0x00b81c5a -[UIViewController __viewWillAppear:] + 148
30 UIKit 0x00b82fab -[UIViewController viewWillMoveToWindow:] + 395
31 UIKit 0x00aa12a8 -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:] + 662
32 UIKit 0x00aad92a -[UIView(Internal) _addSubview:positioned:relativeTo:] + 511
33 UIKit 0x00aa086e -[UIView(Hierarchy) addSubview:] + 56
34 UIKit 0x00a749e3 -[UIWindow addRootViewControllerViewIfPossible] + 512
35 UIKit 0x00a74c99 -[UIWindow _setHidden:forced:] + 287
36 UIKit 0x00a74f50 -[UIWindow _orderFrontWithoutMakingKey] + 49
37 UIKit 0x00a8328d -[UIWindow makeKeyAndVisible] + 80
38 UIKit 0x00a20776 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3108
39 UIKit 0x00a23c0d -[UIApplication _runWithMainScene:transitionContext:completion:] + 1639
40 UIKit 0x00a3c7d0 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59
41 UIKit 0x00a2281f -[UIApplication workspaceDidEndTransaction:] + 155
42 FrontBoardServices 0x035fe9de __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
43 FrontBoardServices 0x035fe46f __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
44 FrontBoardServices 0x03610425 __31-[FBSSerialQueue performAsync:]_block_invoke + 26
45 CoreFoundation 0x001361c0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
46 CoreFoundation 0x0012bad3 __CFRunLoopDoBlocks + 195
47 CoreFoundation 0x0012b92b __CFRunLoopRun + 2715
48 CoreFoundation 0x0012abcb CFRunLoopRunSpecific + 443
49 CoreFoundation 0x0012a9fb CFRunLoopRunInMode + 123
50 UIKit 0x00a221e4 -[UIApplication _run] + 571
51 UIKit 0x00a258b6 UIApplicationMain + 1526
52 To Do 2 0x0002d7fe top_level_code + 78
53 To Do 2 0x0002d83b main + 43
54 libdyld.dylib 0x0235bac9 start + 1
55 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
答案 0 :(得分:0)
第一个问题在这里:
[To_Do_2.FirstViewController tableView:numberOfRowsInSection:]
您并不知道每个rows
需要多少section
。
您可能需要发布您的代码。