我有一个故事板,它有两个视图控制器,包括UINavigationController本身。我在应用程序中做了一些修改,这个错误奇怪地出现了。
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/***/Library/Developer/CoreSimulator/Devices/96021E81-BD05-4193-86ED-7F386739B99E/data/Containers/Bundle/Application/E684814B-7F84-41CE-B762-64C66A4AE4F8/***.app> (loaded)' with name '5JK-D5-ZKP-view-1nz-4p-isc''
我试过禁用大小类,但没有工作。我还深入研究了故事板XML,发现5JK-D5-ZKP
是导航控制器中root view controller
的组成部分,1nz-4p-isc
是UITableViewController
中的表视图,后者是根视图控制器。
发布于 2016-02-27 13:36:08
造成此问题的原因是UITableViewController
子类中存在自定义初始化及其方法init(coder aDecoder: NSCoder)
。由于没有重写其他初始化方法,该重写大致类似于以下内容:
required init?(coder aDecoder: NSCoder) {
// Initialize fetcher
fetcher = QuestionFetcher(delegate: self)
// Call the super.init method
super.init(coder: aDecoder)
// Initialize the activity indicator for fetching questions
activityIndicator = UIActivityIndicatorView(frame: CGRect(x: tableView.frame.size.width / 2.00, y: tableView.frame.size.height / 2.00, width: 20, height: 20))
activityIndicator.hidesWhenStopped = true
activityIndicator.hidden = true
}
有一个棘手的问题是,在故事板中找到的签名的读者试图调用在覆盖中找到的init?(coder: NSCoder)
,但是正如您所看到的,它是一个可故障初始化器。但是视图控制器不是从编码器加载的,所以它失败了。
https://stackoverflow.com/questions/35675423
复制相似问题