[英]Syntax for UIAction on Xcode 11 beta 3
Xcode 11 beta 3 does not accept this code to instantiate UIAction
anymore: Xcode 11 beta 3不再接受以下代码来实例化
UIAction
:
let action = UIAction(__title: "title", image: someImage, options: []) { _ in
// some action
}
There's nothing in the documentation either. 文档中也没有任何内容。
I've found a post on Apple Developer Forums describing this same problem and the syntax that's now accepted, but it results in a runtime error: 我在Apple开发人员论坛上找到了一篇帖子,描述了同样的问题以及现在已经接受的语法,但是它导致运行时错误:
let action = UIAction(__title: "title", image: someImage, identifier: nil, handler: { _ in
// some action
}
+[UIAction actionWithTitle:image:identifier:handler:]: unrecognized selector sent to class 0x7fffa1b30178
There's also this new parameter identifier
, but I couldn't find any documentation about how to use it. 还有一个新的参数
identifier
,但是我找不到有关如何使用它的任何文档。
Has anyone been able to successfully use UIAction
with Xcode 11 beta 3? 有人能成功将
UIAction
与Xcode 11 beta 3一起使用吗?
I don't see where you're getting the options
parameter from. 我看不到您从哪里获得
options
参数。 This compiles and runs (no crash) on my machine using Xcode 11 beta 3: 这会使用Xcode 11 beta 3在我的机器上编译并运行(不会崩溃):
let action = UIAction(__title: "Howdy", image: nil, identifier: nil) {
_ in
}
查看WWDC https://developer.apple.com/videos/play/wwdc2019/224/并转到时间44:46。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.