我制作的应用程序使用商店套件添加一些字符..
我添加了paymentQueue
功能,但是当显示弹出窗口并按Cancel
时,transactionState
为.Completed
在此方法中,如果用户取消交易,则无需支付即可获得该字符。
func paymentQueue(queue: SKPaymentQueue!, updatedTransactions transactions: [AnyObject]!) {
println("add paymnet")
for transaction:AnyObject in transactions {
var trans = transaction as SKPaymentTransaction
switch trans.transactionState {
case .Purchased:
println("Purchase Successful")
SKPaymentQueue.defaultQueue().finishTransaction(transaction as SKPaymentTransaction)
queue.finishTransaction(trans)
break;
case .Failed:
println("Buy Cancelled")
SKPaymentQueue.defaultQueue().finishTransaction(transaction as SKPaymentTransaction)
queue.finishTransaction(trans)
break;
default:
println("default")
break;
}
}
}
This is the link of the tutorial i followed
在真实设备和沙箱用户上测试功能。