导致崩溃的方法:
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: false) // <- Line the crash happens
}
崩溃描述:
<小时/>Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Please file a radar on UIKit if you see this assertion.
请注意,此崩溃仅出现在 iOS 10 上。在 iOS 11 上运行时,代码按预期运行。有人遇到过这个问题或者有人知道任何解决方法吗?
最佳答案
我的 AppDelegate
中有以下行导致了问题。
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).title = ""
去掉这个解决了 iOS 10 的问题。
关于iOS 10 - 导航栏 NSInternalInconsistencyException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48291040/