使用 Square 代码时表达式类型不明确

Type of expression is ambiguous using Square code

我使用针对 Swift 3 的 POS SDK "card present transactions" 建议的方形代码收到以下错误消息:

T ype of expression is ambiguous without more context

有问题的代码行是:

let apiRequest = try SCCAPIRequest(

我相信我已经正确执行了所有准备步骤,例如向 Square 注册 URL 并向 AppDelegate 添加条目。

广场代码是:

do {
// Specify the amount of money to charge
 let money = try SCCMoney(amountCents: 100, currencyCode: "AUD")

// Create the request.
let apiRequest =
    try SCCAPIRequest(
        callbackURL: callbackURL,
        amount: money,
        userInfoString: nil,
        merchantID: locationId,
        notes:  note,
        customerID: nil,
        supportedTenderTypes: .cash, .card,
        clearsDefaultFees: false,
        returnAutomaticallyAfterPayment: false
    )

supportedTenderTypes 是一个 NS_OPTIONS 枚举。如果您计划支持多种招标类型,则需要用方括号将它们括起来,如下所示:

supportedTenderTypes: [.cash, .card]