swift - Swift Stripe 支付界面在收集卡信息后显示错误
问题描述
我正在尝试用 swift 中的条带实现添加付款方式。我能够弄清楚 SwiftUI 集成,但在输入卡信息后我不断收到错误警报
这是生成 STPPaymentOptionsViewController 并在按下添加卡按钮时显示 STPAddCardViewController 的代码。
import Foundation
import SwiftUI
import Stripe
struct PaymentOptionsView: UIViewControllerRepresentable {
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
class Coordinator: NSObject, STPPaymentOptionsViewControllerDelegate {
var control: PaymentOptionsView
init(_ control: PaymentOptionsView) {
self.control = control
}
// Implement required delegate methods here:
func paymentOptionsViewControllerDidCancel(_ paymentOptionsViewController: STPPaymentOptionsViewController) {
}
func paymentOptionsViewControllerDidFinish(_ paymentOptionsViewController: STPPaymentOptionsViewController) {
}
func paymentOptionsViewController(_ paymentOptionsViewController: STPPaymentOptionsViewController, didFailToLoadWithError error: Error) {
}
}
func makeUIViewController(context: UIViewControllerRepresentableContext<PaymentOptionsView>) -> STPPaymentOptionsViewController {
let config = STPPaymentConfiguration()
// config.requiredBillingAddressFields = .none
config.appleMerchantIdentifier = "dummy-merchant-id"
return STPPaymentOptionsViewController(configuration: config, theme: STPTheme(), apiAdapter: STPCustomerContext(keyProvider: MyAPIClient()), delegate: context.coordinator)
}
func updateUIViewController(_ uiViewController: STPPaymentOptionsViewController, context: UIViewControllerRepresentableContext<PaymentOptionsView>) { }
}
这是唯一的错误打印输出
ake a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2021-07-15 07:23:21.114929-0400 app[28150:407027] LOG ANALYTICS: ["apple_pay_enabled": 1, "device_type": "x86_64", "publishable_key": "pk_test_TYooMQauvdEDq54NiTphI7jx", "bindings_version": "21.5.1", "app_name": "konstant", "shipping_type": "shipping", "company_name": "konstant", "ui_usage_level": "partial", "required_shipping_address_fields": "none", "product_usage": ["STPAddCardViewController", "STPCustomerContext", "STPPaymentCardTextField", "STPPaymentOptionsViewController"], "source_type": "card", "os_version": "14.4", "additional_payment_methods": "none", "apple_merchant_identifier": "unknown", "analytics_ua": "analytics.stripeios-1.0", "event": "stripeios.payment_method_creation", "additional_info": [], "required_billing_address_fields": "zip", "ocr_type": "none", "app_version": "1.0"]
2021-07-15 07:23:21.970800-0400 app[28150:407027] Can't find keyplane that supports type 11 for keyboard iPhone-PortraitTruffle-NumberPad; using 25901_PortraitTruffle_iPhone-Simple-Pad_Default
2021-07-15 07:23:22.415522-0400 app[28150:407027] [SwiftUI] Invalid frame dimension (negative or non-finite).
2021-07-15 07:23:22.417320-0400 app[28150:407027] [SwiftUI] Invalid frame dimension (negative or non-finite).
2021-07-15 07:23:22.417689-0400 app[28150:407027] [SwiftUI] Invalid frame dimension (negative or non-finite).
2021-07-15 07:23:22.417927-0400 app[28150:407027] [SwiftUI] Invalid frame dimension (negative or non-finite).
2021-07-15 07:23:22.419214-0400 app[28150:407027] [SwiftUI] Invalid frame dimension (negative or non-finite).
2021-07-15 07:23:22.419532-0400 app[28150:407027] [SwiftUI] Invalid frame dimension (negative or non-finite).
LIS
没有其他可以解释错误的相应消息打印输出
是什么原因造成的,我该如何解决?
解决方案
推荐阅读
- .htaccess - 如何使用 htaccess 将域重写为 s3
- java - 二叉搜索树删除功能擦除整个树
- jquery - 如何使下拉菜单出现在内容上而不是向下推送内容?
- python-3.x - 将安装的 pip 包添加到路径
- typescript - 在打字稿中扩展类与代码重复
- java - Gradle 项目中的 IntelliJ IDEA 编码问题
- angular - 部署应用程序后没有“Access-Control-Allow-Origin”
- java - 如果解析失败,取消表格单元格编辑的规范方法
- java - 调用列表
超时并收集结果 - sql-server - 在从文本文件批量插入期间,数据文件中遇到了意外的文件结尾