【发布时间】:2014-11-12 20:51:14
【问题描述】:
我想我暂时发布了一些关于此的内容,而且问题几乎不再发生了 直到现在我试图创建一个表格视图!
代码如下:
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
}
}
btw -> 我正在使用 Xcode 6.1 和 swift 编程语言!
编辑 -> 错误是“线程 1:信号 SIGABRT”
谢谢, 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)
【问题讨论】:
-
错误是什么?如果没有提及应用委托,代码有何相关性?
-
对不起,我收到的错误是'Thread1:signal SIGABRT'
-
错误发生在哪里,何时发生?有堆栈跟踪吗?这是您应用程序中唯一的 vc 吗?您应该提供更多信息,因为到目前为止提供的信息并没有多大帮助。
-
好吧,当我构建应用程序并运行它时,模拟器似乎崩溃了,然后指示我到 appdelegate 显示“线程 1:信号 SIGABRT”的错误
-
在应用程序崩溃时读取(并发布)Xcode 底部的错误日志,同时读取编译器显示的错误。很可能不是 AppDelegate 错误,在您掌握所有信息之前不要假设任何事情。