如何在Swift 2.2中编写这些函数?

时间:2016-10-25 05:39:16

标签: ios swift function swift2 swift3

我试图在我的iOS应用程序中设置不同类中的两个委托,但是,SDK声明是用Swift 3编写的。以下是我想要转换为Swift 2.2的内容

func paymentMethodsViewController(_ paymentMethodsViewController: STPPaymentMethodsViewController, didFailToLoadWithError error: Error)

func paymentContext(_ paymentContext: STPPaymentContext, didFinishWith status: STPPaymentStatus, error: Error?)

func paymentContext(_ paymentContext: STPPaymentContext, didFailToLoadWithError error: Error)

我收到错误"使用未解析的标识符'错误'"

1 个答案:

答案 0 :(得分:1)

试试这个

func paymentMethodsViewController(paymentMethodsViewController: STPPaymentMethodsViewController, didFailToLoadWithError error: NSError)

func paymentContext(paymentContext: STPPaymentContext, didFinishWith status: STPPaymentStatus, error: NSError?)

func paymentContext(paymentContext: STPPaymentContext, didFailToLoadWithError error: NSError)