当我这样做时,从编译器获取投诉
有什么想法。随意评论。欣赏它。 @H_403_3@谢谢
class ViewController: UIViewController { var delegate : AppDelegate override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view,typically from a nib. //self.appDelegate = UIApplication.sharedApplication().delegate; } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func getData(sender : AnyObject) { } @IBAction func logout(sender : AnyObject) { } }@H_403_3@但是,如果我只是添加?在AppDelegate的结尾,如下所示,错误消失了。
class ViewController: UIViewController { var delegate : AppDelegate? override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view,typically from a nib. //self.appDelegate = UIApplication.sharedApplication().delegate; } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func getData(sender : AnyObject) { } @IBAction func logout(sender : AnyObject) { } }@H_403_3@我没有看到可选关键字与此错误相关,除非我错了。
有什么想法。随意评论。欣赏它。 @H_403_3@谢谢