我是swift的新手,我正在实施无现金Api,其流程如下
https://dev.cashfree.com/payment-gateway/integrations/mobile-integration/ios但我在演示CFViewController时遇到了问题,它显示了警告
Attempt to present <CFSDK.CFViewController> on <UINavigationController> whose view is not in the window hierarchy!我的代码是这样的
CFPaymentService().doWebCheckoutPayment(
params: self.getPaymentParams(),
env: "PROD",
callback: self)而参数是
func getPaymentParams() -> Dictionary<String, Any> {
return [
"orderId": OrderIdForCashFree,
"appId": CashFreeAPIKeyFromServer,
"tokenData" : cftoken,
"orderAmount": AmountExpectedforServer,
"customerName": customerNameCashFree,
"orderNote": orderNoteCashFree,
"orderCurrency": "INR",
"customerPhone": customerPhoneCashFree,
"customerEmail": customerEmailCashFree,
"notifyUrl": ""
]
}请帮帮我!
发布于 2021-06-15 14:47:50
警告看起来更好,就像这样-
Attempt to present <CFSDK.CFViewController>
on <UINavigationController>
whose view is not in the window hierarchy!看起来您调用这个方法太早了--可能是在viewDidLoad()中
CFPaymentService().doWebCheckoutPayment(
params: self.getPaymentParams(),
env: "PROD",
callback: self
)如果视图尚未正确设置,您将收到来自UIKit的此警告。你能做的是-
这两个都将确保视图有足够的时间显示(在呼叫发起之前),并且警告将消失。
https://stackoverflow.com/questions/67980891
复制相似问题