我昨天升级了我的xcode到11.4,现在我不能归档我的SwiftUI代码来提交应用程序存储,因为错误:“错误:分段错误: 11",”xxx- Failed .dia:1:1: Cannot read serialized diagnostics file: Cannot Load File: Failed to open diagnostics file“。
有什么建议吗?
发布于 2020-05-23 07:38:26
我的根导致此错误的发生是因为在XIB UIView的类func中使用了'Self‘。这个错误发生在我的XCode 11.5中,并且只发生在项目的发布版本中。所以,看起来问题出在-O编译上。(看起来像是名为Swift的学术项目重新发现了有用的自我概念)
下面的示例导致Segfault11,通过将三个"Self“替换为类名”StyleHSView“修复:
class StyleHSView: UIStackView, UITextFieldDelegate {
@IBOutlet weak var styleNameTF: UITextField!
@IBOutlet weak var urlTF: UITextField!
// THIS FUNC CAUSES segfault 11, fix by changing Self to class name StyleHSView.
class func Instantiate() -> Self {
let nib = UINib.init(nibName: "StyleHSView", bundle: nil)
if let view = nib.instantiate(withOwner: nil, options: nil).first(where: { return $0 is Self }) as? Self
{
return view
} else {
fatalError("No StyleHSView")
}
}
}发布于 2020-05-07 05:29:39
类似于issue @foolbear commented above中的this commenter体验,这是由我的视图之一的修饰符引起的。
在我的例子中,我在UIViewRepresentable上使用了Introspect修饰符。
在错误的堆栈转储中,找出发生问题的视图,并尝试删除视图修饰符,直到错误消失。
https://stackoverflow.com/questions/60861226
复制相似问题