gpt4 book ai didi

ios - 重置应用内购买以进行测试?

转载 作者:行者123 更新时间:2023-11-30 14:14:50 29 4
gpt4 key购买 nike

我在我的应用中添加了“删除广告”选项。我曾经在沙盒模式下购买过它,但我需要重置它以进行测试。它需要重置,因此当我尝试再次购买时,它不会免费恢复。

func paymentQueue(queue: SKPaymentQueue!, updatedTransactions transactions: [AnyObject]!) {
println("add payment")

for transactions:AnyObject in transactions {
var trans = transactions as! SKPaymentTransaction
println(trans.error)

switch trans.transactionState{

case .Purchased:
println("buy, ok unlock iad here")
println(p.productIdentifier)

let prodID = p.productIdentifier as String

switch prodID {
case "removeAds":
println("remove ads")
removeAds()
break;

default:
println("IAP not set up")
}

case .Failed:
println("buy error")
queue.finishTransaction(trans)
break;

default:
println("default")
break;
}
}
}

func removeAds(){
noAdsButton.alpha = 0.0
adsOk = false
adsOkDefault.setBool(false, forKey: "adsOk")
println("REMOVE THE ADS")
}

我正在使用 StoreKit。

最佳答案

要在初始调试期间反复测试您的 IAP,最简单的方法是将非消耗性 IAP 暂时切换为消耗性。然后你就可以通过反复购买来调试它。一旦你摆脱了大多数错误,你就可以将其切换回非消耗品。那么测试将变得更加困难,因为您每次都需要创建一个新的测试用户。这里有关于这个问题的更长的文章:

Clearing purchases from IOS in-app purchase sandbox for a test user

关于ios - 重置应用内购买以进行测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31321848/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com