【发布时间】:2016-03-20 23:27:07
【问题描述】:
所以我编写了一些代码,它应该打开一个名为 MobilePay 的应用程序。问题是当我尝试制作 else 语句时,我的代码不会在 SWIFT 中被接受。有人可以告诉我有什么问题吗? - SWIFT 告诉我有一个错误。
错误在于它需要某种表达式
@IBAction func Invoker(sender: AnyObject) {
let alertController = UIAlertController(title: "Betal", message: "Vælg en af nedstående betalingsmulighed", preferredStyle: .ActionSheet)
let ok1 = UIAlertAction(title: "MobilePay", style: .Default, handler: { (action) -> Void in
let url = NSURL(string: "mobilepay://")
if UIApplication.sharedApplication().canOpenURL(url!) == true
{
UIApplication.sharedApplication().openURL(url!)
} else {
}
let cancel = UIAlertAction(title: "Annuller", style: .Destructive) { (action) -> Void in
}
alertController.addAction(ok1)
alertController.addAction(cancel)
presentViewController(alertController, animated: true, completion: nil)
}
}
【问题讨论】:
-
错误到底在哪里?完整的错误信息到底是什么?
-
错误是它需要某种表达,我看不出它是什么。
标签: ios swift uialertcontroller