我是 Xcode 的新手并下载了最新的 9.2 版本,我试图在按钮中插入指向 Web 的链接但无法正常工作。这是代码。 链接不起作用
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func button(_ sender: Any) {
if let url = URL(string: "https://www.youtube.com/watch?v=UPfA3mUfvGA&t=90s") {
UIApplication.shared.canOpenURL(url)
UIApplication.shared.open(url, options: [:], completionHandler:nil)
}
}
}
当您按下 Guorlin Premium 按钮时,它会将您带到一个网站
现在,当我按下 Guorlin Premium 按钮不起作用时,它不会将我带到网站。