Xcode AppDelegate错误

Xcode AppDelegate错误,xcode,swift,Xcode,Swift,我想我发布了一些关于这个的信息,好吧,问题几乎不再发生了 直到现在,当我试图创建一个表视图 代码如下: import UIKit class ViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a

我想我发布了一些关于这个的信息,好吧,问题几乎不再发生了 直到现在,当我试图创建一个表视图

代码如下:

import UIKit

class ViewController: UITableViewController {

    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.
    }
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell

        {
            var cell = tableView.dequeueReusableCellWithIdentifier("myCell", forIndexPath:indexPath) as UITableViewCell
            cell.textLabel.text = "Cell number \(indexPath.row)"
            return cell
        }
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
    {
        return 11 
    }


}
顺便说一句->我使用的是使用swift编程语言的Xcode 6.1

编辑->错误为“线程1:信号信号信号”

thnx, appswiftgb

错误日志

2014-11-12 20:42:40.672 tableViewTutorial[5949:94056] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "vXZ-lx-hvc-view-kh9-bI-dsS" nib but didn't get a UITableView.'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000107377f35 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000108ebbbb7 objc_exception_throw + 45
    2   CoreFoundation                      0x0000000107377e6d +[NSException raise:format:] + 205
    3   UIKit                               0x0000000107ee5415 -[UITableViewController loadView] + 249
    4   UIKit                               0x0000000107d287f9 -[UIViewController loadViewIfRequired] + 75
    5   UIKit                               0x0000000107d5706b -[UINavigationController _layoutViewController:] + 44
    6   UIKit                               0x0000000107d575b5 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 216
    7   UIKit                               0x0000000107d576b4 -[UINavigationController _startTransition:fromViewController:toViewController:] + 92
    8   UIKit                               0x0000000107d58487 -[UINavigationController _startDeferredTransitionIfNeeded:] + 523
    9   UIKit                               0x0000000107d58f47 -[UINavigationController __viewWillLayoutSubviews] + 43
    10  UIKit                               0x0000000107e9e509 -[UILayoutContainerView layoutSubviews] + 202
    11  UIKit                               0x0000000107c7c973 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
    12  QuartzCore                          0x000000010bb7ade8 -[CALayer layoutSublayers] + 150
    13  QuartzCore                          0x000000010bb6fa0e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    14  QuartzCore                          0x000000010bb6f87e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    15  QuartzCore                          0x000000010badd63e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
    16  QuartzCore                          0x000000010bade74a _ZN2CA11Transaction6commitEv + 390
    17  UIKit                               0x0000000107c0154d -[UIApplication _reportMainSceneUpdateFinished:] + 44
    18  UIKit                               0x0000000107c02238 -[UIApplication _runWithMainScene:transitionContext:completion:] + 2642
    19  UIKit                               0x0000000107c00bf2 -[UIApplication workspaceDidEndTransaction:] + 179
    20  FrontBoardServices                  0x000000010aa482a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
    21  CoreFoundation                      0x00000001072ad53c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    22  CoreFoundation                      0x00000001072a3285 __CFRunLoopDoBlocks + 341
    23  CoreFoundation                      0x00000001072a3045 __CFRunLoopRun + 2389
    24  CoreFoundation                      0x00000001072a2486 CFRunLoopRunSpecific + 470
    25  UIKit                               0x0000000107c00669 -[UIApplication _run] + 413
    26  UIKit                               0x0000000107c03420 UIApplicationMain + 1282
    27  tableViewTutorial                   0x0000000107198f4e top_level_code + 78
    28  tableViewTutorial                   0x0000000107198f8a main + 42
    29  libdyld.dylib                       0x0000000109695145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

尝试为您的表视图委托实现numberOfSections,它可能会崩溃,因为缺少该委托。

您应该做的是使用IB从对象库中拖动一个表视图控制器,然后将Class属性设置为UITableViewController子类


如果您只是将IB中常规视图控制器的类更改为UITableViewController子类,它将不会为您创建tableview。

错误是?如果没有提到应用程序委托,代码的相关性如何?哦,很抱歉,我要说我收到的错误是“Thread1:SIGABRT”,错误发生在哪里,何时发生?有堆栈跟踪吗?这是你应用程序中唯一的vc吗?你应该提供更多信息,因为到目前为止提供的信息没有多大帮助。当我构建并运行应用程序时,看起来仿真器崩溃了,然后将我引导到appdelegate,向我显示“Thread1:SIGABRT”read的错误,并在Xcode底部发布错误日志,当应用程序崩溃时,还会读取编译器显示的错误。这很可能不是AppDelegate错误。在获得所有信息之前,不要假设任何事情。