Hello,
I have one issue regarding in-app purchase.
The problem is that SKProductsRequest returns 0 product in the App Review environment.
The in-app products identifiers are hardcoded in the app,
so there's no possibility that the app fails to query product identifiers or it passes incorrect product identifiers as a parameter when it creates SKProductsRequest(productIdentifiers: Set<String>) instance.
The app works fine here. It means SKProductsRequest returns the products information successfully here (maybe Apple’s sandbox IAP environment).
But SKProductsRequest is returning 0 product in the App Review environment. (maybe Apple’s real App store environment)
I really can't understand why the SKProductsRequest is failing to validate the In-App product identifiers in the App Review environment.
Please help me to find the reason or any clue to the issue.
Thank you
================== Source Code =================
class ShopViewController: UIViewController, SKProductsRequestDelegate
…
override func viewDidLoad() {
…
// getProductIDs() returns the Set<String> of hard-coded product identifiers,
// so there's no possibility that the app does not know product identifiers or it passes the incorrect product identifiers.
let productIDs = getProductIDs()
let productRequest = SKProductsRequest(productIdentifiers: productIDs)
productRequest.delegate = self
productRequest.start()
}
func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
if response.products.count > 0 {
[The app shows available products to user.]
// In out test environment,
// response.products.count is always bigger than 0 and there’s no problem selling in-app products.
}
else {
// ▶︎▶︎▶︎ The App-Review Issue occurs here ◀︎◀︎◀︎
// In the App-Review environment
// response.products.count is 0.
// I really can't understand why the SKProductsRequest is failing to validate the In-App product identifiers in the App Review environment.
[The app shows the alert message describing there’s no product to sale.]
}
}
public func request(_ request: SKRequest, didFailWithError error: Error) {
[The app shows the message of error.localizedDescription to user.]
}
…
}