我设置了委托PGTransactionDelegate,但是它显示了一个错误,比如视图控制器不符合协议"PGTransactionDelegate“
代码:
桥接中的Paytm目标标头-标头
#import "PaymentsSDK.h视图控制器中的委托方法
// On Successful Payment
func didSucceedTransaction(controller: PGTransactionViewController, response: [NSObject : AnyObject]) {
print(response)
print("Deducted amount :Rs. \(response["TXNAMOUNT"]!)")
self.removeController(controller)
}
// On Failure
func didFailTransaction(controller: PGTransactionViewController, error: NSError, response: [NSObject : AnyObject]) {
print(response)
if response.count == 0 {
print(response.description)
}
else if error != 0 {
print(error.localizedDescription)
}
self.removeController(controller)
}
//On Cancellation
func didCancelTransaction(controller: PGTransactionViewController, error: NSError, response: [NSObject : AnyObject]) {
print("Transaction has been Cancelled")
self.removeController(controller)
}
func didFinishCASTransaction(controller: PGTransactionViewController, response: [NSObject : AnyObject]) {
print(response);
}发布于 2017-08-02 10:59:34
如果您最近将代码更新为Swit3.0,则可能会对委托函数进行语法更改,请检查这一点。
发布于 2018-05-30 10:33:16
请更正桥接头中的Paytm目标标头。
#导入"PaymentsSDK.h“
如果你使用的是斯威夫特3或斯威夫特4,那么这些方法可以解决你的问题。
// On Successful Payment
func didSucceedTransaction(_ controller: PGTransactionViewController!, response: [AnyHashable : Any]!) {
printLog(log: response)
}
// On Failure
func didFailTransaction(_ controller: PGTransactionViewController!, error: Error!, response: [AnyHashable : Any]!) {
printLog(log: response)
printLog(log: error.localizedDescription)
}
//On Cancellation
func didCancelTransaction(_ controller: PGTransactionViewController!, error: Error!, response: [AnyHashable : Any]!) {
printLog(log: response)
root.navigationController?.popViewController(animated: true)
}https://stackoverflow.com/questions/45457367
复制相似问题