在真实设备上测试了IAP之后,我通过AppStoreConnect发送了一个二进制文件进行审查,并由其他测试人员通过TestFlight进行了
他们拒绝了我的二进制说法,即“点击IAP时不会采取任何行动”
我仔细检查了IAP是否已准备好提交并添加到了表单底部的版本中
这是购买按钮的代码:
@IBAction func showMeteoTouched(_ sender: Any) {
let alert = UIAlertController(title: "DroneSpot Premium", message: NSLocalizedString("UnlockMeteoAlertTitle", comment: ""), preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: NSLocalizedString("PremiumPrice", comment: ""), style: .default, handler: { action in
IAPHandler.shared.purchaseMyProduct(index: 0)
}))
alert.addAction(UIAlertAction(title: NSLocalizedString("RestoreProduct", comment: ""), style: .default, handler: { action in
IAPHandler.shared.restorePurchase()
}))
alert.addAction(UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: nil))
self.present(alert, animated: true)
}
我的班级:
class IAPHandler: NSObject {
static let shared = IAPHandler()
let premiumID = "dronespot.premium"
fileprivate var productID = ""
fileprivate var productsRequest = SKProductsRequest()
fileprivate var iapProducts = [SKProduct]()
var purchaseStatusBlock: ((IAPHandlerAlertType) -> Void)?
// MARK: - MAKE PURCHASE OF A PRODUCT
func canMakePurchases() -> Bool { return SKPaymentQueue.canMakePayments() }
func purchaseMyProduct(index: Int){
if iapProducts.count == 0 { return }
if self.canMakePurchases() {
let product = iapProducts[index]
let payment = SKPayment(product: product)
SKPaymentQueue.default().add(self)
SKPaymentQueue.default().add(payment)
print("PRODUCT TO PURCHASE: \(product.productIdentifier)")
productID = product.productIdentifier
} else {
purchaseStatusBlock?(.disabled)
}
}
// MARK: - RESTORE PURCHASE
func restorePurchase(){
SKPaymentQueue.default().add(self)
SKPaymentQueue.default().restoreCompletedTransactions()
}
在某些主题上,我听说我们必须等待几个小时才能使应用程序正常运行,但是Apple团队在我的TestFlight用户对其进行了测试之后,对我的应用程序进行了审核。 我将在今天晚上尝试重新提交