【发布时间】:2017-05-15 22:17:23
【问题描述】:
为什么这个 Square 示例直接因为他们的 README 不起作用?
let callbackURL = URL(string: "OdinMobile://")!
do {
let amount = try SCCMoney(amountCents: money, currencyCode: "USD")
let request : SCCAPIRequest =
try SCCAPIRequest(
callbackURL: callbackURL,
amount: amount,
userInfoString: userInfoString,
merchantID: nil,
notes: notes,
customerID: nil,
supportedTenderTypes: supportedTenderTypes,
clearsDefaultFees: clearsDefaultFees,
returnAutomaticallyAfterPayment: true
)
} catch let error as NSError {
print(error.localizedDescription)
}
do {
try SCCAPIConnection.perform(request)
} catch let error as NSError {
print(error.localizedDescription)
}
我收到了一个 Cannot invoke 'perform' with an argument list of type '(_)' 和一条附加消息 Overloads for 'perform' exist with these partially matching parameter lists: (SCCAPIRequest), (Selector!)。我希望request 成为一个 SCCAPIRequest,为什么它不作为一个读取?是因为它在do 块中吗?
【问题讨论】:
标签: swift xcode square-connect