2016-09-22 3 views
0

私のビューコントローラは、ちょうどUITableViewを持っています。 これは私のコードです。のUITableView信号SIGBRT

// 
// FriendTableViewController.swift 
// Tiat 
// 
// Created by 이종승 on 2016. 9. 23.. 
// Copyright © 2016년 JW. All rights reserved. 
// 

import UIKit 
import Firebase 

class FriendTableViewController: UITableViewController { 

    var users = [User]() 
    let cellId = "friendsCell" 
    override func viewDidLoad() { 
     super.viewDidLoad() 
     fetchUser() 

    } 
    @IBOutlet var ttableView: UITableView! 

    func fetchUser() { 
     FIRDatabase.database().reference().child("users").observe(.childAdded, with: {snapshot in 

      if let dictionary = snapshot.value as? [String: AnyObject] { 
       let user = User() 
       user.name = dictionary["name"] as? String 
       user.gender = dictionary["gender"] as? String 
       user.birthday = dictionary["birthday"] as? String 
       user.point = dictionary["point"] as? Int 

       print(user.name, user.gender, user.birthday, user.point) 
       self.users.append(user) 
       DispatchQueue.main.async { 
        self.tableView.reloadData() 
       } 
      } 
     }) 
    } 

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 
     return users.count 
    } 

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 
     let cell = UITableViewCell(style: .subtitle, reuseIdentifier: cellId) 
     let user = users[indexPath.row] 
     cell.textLabel?.text = user.name 
     return cell 
    } 


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


} 

//エラーログ//

2016-09-23 23:49:33.092 Tiat[14923:1376968] *** Terminating app due to  uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "8rJ-Kc-sve-view-QS5-Rx-YEW" nib but didn't get a UITableView.' 
*** First throw call stack: 
(
    0 CoreFoundation      0x000000010f94734b __exceptionPreprocess + 171 
    1 libobjc.A.dylib      0x000000010f3a821e objc_exception_throw + 48 
    2 CoreFoundation      0x000000010f9b0265 +[NSException raise:format:] + 197 
    3 UIKit        0x000000011018b7d2 -[UITableViewController loadView] + 532 
    4 UIKit        0x000000010ff0bc4c -[UIViewController loadViewIfRequired] + 201 
    5 UIKit        0x000000010ff4c44f -[UINavigationController _layoutViewController:] + 55 
    6 UIKit        0x000000010ff4cd37 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 471 
    7 UIKit        0x000000010ff4ceae -[UINavigationController _startTransition:fromViewController:toViewController:] + 133 
    8 UIKit        0x000000010ff4e0b9 -[UINavigationController _startDeferredTransitionIfNeeded:] + 874 
    9 UIKit        0x000000010ff4f19b -[UINavigationController __viewWillLayoutSubviews] + 58 
    10 UIKit        0x00000001101461b7 -[UILayoutContainerView layoutSubviews] + 223 
    11 UIKit        0x000000010fe2f344 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237 
    12 QuartzCore       0x0000000114ba4cdc -[CALayer layoutSublayers] + 146 
    13 QuartzCore       0x0000000114b987a0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 
    14 QuartzCore       0x0000000114b9861e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 
    15 QuartzCore       0x0000000114b2662c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280 
    16 QuartzCore       0x0000000114b53713 _ZN2CA11Transaction6commitEv + 475 
    17 UIKit        0x000000010fd64067 _UIApplicationFlushRunLoopCATransactionIfTooLate + 206 
    18 UIKit        0x0000000110573b30 __handleEventQueue + 5672 
    19 CoreFoundation      0x000000010f8ec311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 
    20 CoreFoundation      0x000000010f8d159c __CFRunLoopDoSources0 + 556 
    21 CoreFoundation      0x000000010f8d0a86 __CFRunLoopRun + 918 
    22 CoreFoundation      0x000000010f8d0494 CFRunLoopRunSpecific + 420 
    23 GraphicsServices     0x0000000112696a6f GSEventRunModal + 161 
    24 UIKit        0x000000010fd6af34 UIApplicationMain + 159 
    25 Tiat        0x000000010cdcc6cf main + 111 
    26 libdyld.dylib      0x0000000111f8e68d start + 1 
    27 ???         0x0000000000000001 0x0 + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
(lldb) 

編集

と1以上の非常に奇妙なことがあります。

自分のコードをすべて削除してみたところ、以前と同じエラーが発生しました。

+1

エラーメッセージを追加してください... –

答えて

1

推測すると、プロトタイプセルは作成されていません。

このテーブルビューにセルを追加し、cellIdに割り当てた識別子名を付けます。

+0

再利用識別子は引用符で囲む必要があります。 – user3739902

+0

そうであってはいけません、OPは 'cellId' nameを持つ変数を宣言しました。 –

+0

あなたはそうです、私はそれを見ませんでした。 – user3739902