0
爲什麼這個Square示例直接針對他們的README不起作用?無法用類型爲'(_)'的參數列表調用'perform'
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
區塊嗎?
我想,我應該自己試過。 –
@NilsGuillermin請一定要接受這個答案,當你有機會...感謝隊友! –