当我们点击交易取消按钮两次然后应用程序崩溃并且我们正在
断言失败 - [PGTransactionViewController cancelCallback:响应:],/用户/与Pradeep / _Projects / Paytm / pgsdk / PaymentsSDK / PaymentsSDK / PGTransactionViewController.m:217 2016-04-25 16:31:25.228 MyDemo [4669:92001] ***由于终止应用程序 未被捕获的异常' NSInternalInconsistencyException',原因:'没有 代表集?...你打算怎么回电?'
代码
///PaymentGateway With OrderID
func initiatePaymentGatewayWithOrderID() {
//Step 1: Create a default merchant config object
let pgMerchantConfiguration = PGMerchantConfiguration.defaultConfiguration()
//Step 2: If you have your own checksum generation and validation url set this here. Otherwise use the default Paytm urls
//prod/staging urls are decided based on the build configuration, go to Url.swift and check the host url configuration
pgMerchantConfiguration.checksumGenerationURL = Url.paytmChecksumGenerationURL
pgMerchantConfiguration.checksumValidationURL = Url.paytmChecksumValidationURL
//Step 3: Create the order with whatever params you want to add. But make sure that you include the merchant mandatory params
var orderDict = [String : AnyObject]()
orderDict["MID"] = self.slotTestCenter?.mID
orderDict["CHANNEL_ID"] = self.slotTestCenter?.channelID
orderDict["INDUSTRY_TYPE_ID"] = self.slotTestCenter?.industryTypeID
orderDict["WEBSITE"] = self.slotTestCenter?.website
//Order configuration in the order object
orderDict["TXN_AMOUNT"] = self.slotTestCenter?.txnAmount
orderDict["ORDER_ID"] = self.slotTestCenter?.orderId
orderDict["REQUEST_TYPE"] = "DEFAULT";
orderDict["CUST_ID"] = self.slotTestCenter?.custID
orderDict["EMAIL"] = self.slotTestCenter?.email
orderDict["MOBILE_NO"] = self.slotTestCenter?.mobileNo
debugLog(orderDict)
let order = PGOrder(params: orderDict)
debugLog(order)
self.txnController = PGTransactionViewController(transactionForOrder: order)
//A staging server is a mix between production and development; you get to test your app as if it were in production
self.txnController!.serverType = eServerTypeStaging
// Set the merchant configuration for the transaction.
self.txnController!.merchant = pgMerchantConfiguration
// A delegate object should be set to handle the responses coming during the transaction
self.txnController!.delegate = self
self.navigationController?.pushViewController(self.txnController!, animated: true)
}
//Called when a transaction is Canceled by User. response dictionary will be having details about Canceled Transaction.
func didCancelTransaction(controller: PGTransactionViewController!, error: NSError!, response: [NSObject : AnyObject]!) {
if self.txnController != nil {
//Access AbcViewController in navigation stack and pop
for viewController in self.navigationController!.viewControllers as [UIViewController] {
if viewController.isKindOfClass(AbcViewController) {
self.navigationController?.popToViewController(viewController, animated: false)
return
}
}
}
}
有人有解决方案吗?