我不断收到此错误:
Implicit use of 'self' in closure; use 'self.' to make capture semantics explicit
即使我将自身放入代码中。请纠正我。
这是我的代码:
@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需要更正。
答案 0 :(得分:3)
public partial class UserProfile
{
public long Creater { get; set; }
public long Modifier { get; set; }
public long Deleter { get; set; }
...
...
public virtual User User { get; set; }
public virtual User User1 { get; set; }
public virtual User User2 { get; set; }
}
是一种方法,您暗中调用performSegue
;显式版本为self
。
答案 1 :(得分:0)
只需将您的代码行从performSegue(withIdentifier: "welcomeButton", sender:self)
更改为self.performSegue(withIdentifier: "welcomeButton", sender:self)