![](/img/trans.png)
[英]“Terminating app due to uncaught exception 'NSInternalInconsistencyException'” error message
[英]Terminating app due to uncaught exception 'NSInternalInconsistencyException' error
class HomeViewController: UIViewController {
@IBOutlet weak var userNameLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Show the current visitor's username
if let pUserName = PFUser.currentUser()?["username"] as? String {
self.userNameLabel?.text = "@" + pUserName
}
}
override func viewWillAppear(animated: Bool) {
if (PFUser.currentUser() == nil) {
dispatch_async(dispatch_get_main_queue(), { () -> Void in
let viewController:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("Login")
self.presentViewController(viewController, animated: true, completion: nil)
})
}
}
@IBAction func commentAction(sender: AnyObject) {
self.performSegueWithIdentifier("CommentSegue", sender: self)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "CommentSegue"{
let summaryView = segue.destinationViewController as? TableViewController
}
}
}
我得到的错误是:
由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'-[UITableViewController loadView]从情节提要“ Main”实例化了具有标识符“ UIViewController-tCJ-qt-q4b”的视图控制器,但未获得UITableView。
有人知道我该如何解决吗?
您创建的控制器是UITableViewController
或一个的子类。 该错误告诉您该控制器的顶级视图不是UITableView
。
您需要在情节提要中修复视图控制器的链接,或者将控制器更改为其他类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.