2014-12-14 2 views
0

새 탭 프로젝트에 테이블 뷰를 추가하려고 할 때 해독 할 수 없다는 오류가 발생합니다.새 탭 프로젝트에 테이블 뷰를 추가 할 수 없음

내 스토리 보드에 tableview를 추가 한 다음 앱을 빌드하면됩니다. 그러나 바로 "델리게이트"와 "데이터 소스"를 Ctrl 키를 누른 채 노란색 원으로 드래그하여 컨트롤러에 연결하면 빌드가 실패합니다. 왜 이런 일이 생길까요?

정확한 생식 단계 :

  1. 은 엑스 코드에서 새로운 "탭보기 '프로젝트를 만듭니다.
  2. 스토리 보드에서 '스토리 보드'로 '테이블보기'를 드래그합니다.
  3. "Table View"에서 "ctrl click"을 클릭 한 다음 "dataSource"및 "delegate"를 스토리 보드 상단의 노란색 원 + 흰색 상자 아이콘으로 드래그하십시오.
  4. FirstViewController.swift를 열고 클래스에 UITableViewDelegate, UITableViewDataSource을 추가하려고합니다. 그러나 컨트롤러가 존재하지 않는다고 생각하는 것처럼 이들 중 어느 것도 자동 완성에 표시되지 않습니다. 내가 명령을 클릭하면 "기호를 찾을 수 없습니다"라는 메시지가 나타납니다.

FirstViewController.swift

// 
// FirstViewController.swift 
// To Do List 
// 
// Created by Donald Pinkus on 12/14/14. 
// Copyright (c) 2014 Don Pinkus. All rights reserved. 
// 

import UIKit 

class FirstViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { 

    override func viewDidLoad() { 
     super.viewDidLoad() 
     // Do any additional setup after loading the view, typically from a nib. 
    } 

    override func didReceiveMemoryWarning() { 
     super.didReceiveMemoryWarning() 
     // Dispose of any resources that can be recreated. 
    } 


} 

빌드 오류

2014-12-14 00:27:04.278 To Do List[11149:566768] -[To_Do_List.FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7faafae29ba0 
2014-12-14 00:27:04.285 To Do List[11149:566768] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[To_Do_List.FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7faafae29ba0' 
*** First throw call stack: 
(
    0 CoreFoundation      0x0000000105422f35 __exceptionPreprocess + 165 
    1 libobjc.A.dylib      0x0000000106f66bb7 objc_exception_throw + 45 
    2 CoreFoundation      0x000000010542a04d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 
    3 CoreFoundation      0x000000010538227c ___forwarding___ + 988 
    4 CoreFoundation      0x0000000105381e18 _CF_forwarding_prep_0 + 120 
    5 UIKit        0x0000000105f26212 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 2353 
    6 UIKit        0x0000000105f2a098 -[UITableViewRowData numberOfRows] + 97 
    7 UIKit        0x0000000105d928fc -[UITableView noteNumberOfRowsChanged] + 133 
    8 UIKit        0x0000000105d9203d -[UITableView reloadData] + 1316 
    9 UIKit        0x0000000105d9ad86 -[UITableView layoutSubviews] + 31 
    10 UIKit        0x0000000105d27973 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521 
    11 QuartzCore       0x0000000109c25de8 -[CALayer layoutSublayers] + 150 
    12 QuartzCore       0x0000000109c1aa0e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380 
    13 UIKit        0x0000000105d1b847 -[UIView(Hierarchy) layoutBelowIfNeeded] + 611 
    14 UIKit        0x0000000105e0ff06 -[UITabBarController _layoutViewController:] + 500 
    15 UIKit        0x0000000105e10014 -[UITabBarController _wrapperViewForViewController:] + 252 
    16 UIKit        0x0000000105e16e92 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 378 
    17 UIKit        0x0000000105e13069 -[UITabBarController _setSelectedViewController:] + 311 
    18 UIKit        0x0000000105d1f5ce +[UIView(Animation) performWithoutAnimation:] + 65 
    19 UIKit        0x0000000105e10106 -[UITabBarController _selectDefaultViewControllerIfNecessaryWithAppearanceTransitions:] + 221 
    20 UIKit        0x0000000105e10dfe -[UITabBarController viewWillAppear:] + 121 
    21 UIKit        0x0000000105dd7821 -[UIViewController _setViewAppearState:isAnimating:] + 487 
    22 UIKit        0x0000000105d1a136 -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:] + 564 
    23 UIKit        0x0000000105d24aaa -[UIView(Internal) _addSubview:positioned:relativeTo:] + 419 
    24 UIKit        0x0000000105cf2e37 -[UIWindow addRootViewControllerViewIfPossible] + 456 
    25 UIKit        0x0000000105cf3041 -[UIWindow _setHidden:forced:] + 247 
    26 UIKit        0x0000000105cff72c -[UIWindow makeKeyAndVisible] + 42 
    27 UIKit        0x0000000105caa061 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2628 
    28 UIKit        0x0000000105cacd2c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1350 
    29 UIKit        0x0000000105cabbf2 -[UIApplication workspaceDidEndTransaction:] + 179 
    30 FrontBoardServices     0x0000000108af32a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16 
    31 CoreFoundation      0x000000010535853c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12 
    32 CoreFoundation      0x000000010534e285 __CFRunLoopDoBlocks + 341 
    33 CoreFoundation      0x000000010534e045 __CFRunLoopRun + 2389 
    34 CoreFoundation      0x000000010534d486 CFRunLoopRunSpecific + 470 
    35 UIKit        0x0000000105cab669 -[UIApplication _run] + 413 
    36 UIKit        0x0000000105cae420 UIApplicationMain + 1282 
    37 To Do List       0x00000001052403ce top_level_code + 78 
    38 To Do List       0x000000010524040a main + 42 
    39 libdyld.dylib      0x0000000107740145 start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
(lldb) 

답변

0

당신은 필요한 numberOfRowsInSection 방법을 누락되었습니다. 당신이 numberOfRowsInSection을 구현하는 데 필요한 UITableViewDataSourcecellForRowAtIndexPath

+0

내가 + 명령하지만'UITableViewDelegate' 또는'UITableViewDataSource' 클릭 할 수 없어야 될하기 위해 ? 지금 내가 할 때 "심볼을 찾을 수 없습니다". 이것이 무언가가 올바르게 연결되어 있지 않다는 것을 의미하는지 궁금해하고있었습니다. –

+1

Xcode 버그와 비슷합니다. numberOfRowsInSection을 찾을 수 없기 때문에 앱이 다운된다는 사실은이 프로토콜을 알고 있음을 의미합니다. – YogevSitton

관련 문제