gpt4 book ai didi

ios - 由于未捕获的异常 'NSInternalInconsistencyException' 错误而终止应用程序

转载 作者:行者123 更新时间:2023-11-28 10:18:40 26 4
gpt4 key购买 nike

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

}

}

}

我得到的错误是:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] instantiated view controller with identifier "UIViewController-tCJ-qt-q4b" from storyboard "Main", but didn't get a UITableView.'

有人知道我该如何解决这个问题吗?

最佳答案

您创建的 Controller 是 UITableViewController 或其子类。该错误告诉您该 Controller 的顶级 View 不是 UITableView

您需要修复 Storyboard中 View Controller 的链接,或者将 Controller 更改为其他类。

关于ios - 由于未捕获的异常 'NSInternalInconsistencyException' 错误而终止应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37779086/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com