有人知道如何解决此错误吗?否则,我可能会创建自己的警报模式?看来这是一个老错误-至少是从macOS 10.15.3起,现在是10.15.5,至今仍未解决。有趣的是,在按下查看后的最初几毫秒内,它可以正确呈现-仅显示2个按钮,然后中断。Alert with multiple buttons
fileprivate func foo() -> Alert {
return Alert(title: Text("Foo"),
message: Text("Are you sure you want to ..."),
primaryButton: .default(Text("Yes"), action: {
self.fooAction()
}), secondaryButton: .default(Text("No")))
}
并称为:
.alert(isPresented: $isShowingFoo, content:{
foo()
})