gpt4 book ai didi

swift - 我不断收到此错误 : "Implicit use of ' self' in closure; use 'self.' to make capture semantics explicit"

转载 作者:行者123 更新时间:2023-11-28 10:06:12 25 4
gpt4 key购买 nike

我一直收到这个错误:

Implicit use of 'self' in closure; use 'self.' to make capture semantics explicit

即使我将 self 放在代码中。请指正。

这是我的代码:

@IBAction func doneButton(_ sender: Any) {
let code = codeTextField.text
if code == "TEST" || code == "Test" || code == "test" {
var myAlert = UIAlertController(title:"Alert", message: "You are logging into The Test Zoo, right?", preferredStyle: UIAlertController.Style.alert)
let yesAction = UIAlertAction(title: "Yes", style: UIAlertAction.Style.default) {
UIAlertAction in
performSegue(withIdentifier: "welcomeButton", sender:self)
}

还有更多,但是 yesAction 需要更正。

最佳答案

performSegue 是一种方法,您在 self 上隐式调用它;显式版本将是 self.performSegue(...)

关于swift - 我不断收到此错误 : "Implicit use of ' self' in closure; use 'self.' to make capture semantics explicit",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53147808/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com