I'm trying to do fetch ProductIDs. But response always be null. I want to show what I do.
Created ProductID's:
`enum IAPProduct: String {
case Consumble = "com.xxxx.xxx.Consumable"
case nonConsumble = "com.xxxx.xxx.TekSeferAl"
}`
My fetch code:
class IAPService: NSObject {
static let shared = IAPService()
private override init() {}
//MARK:- Properties
//MARK:- Private
func getProducts() {
SKPaymentQueue.canMakePayments()
let products: Set = [IAPProduct.Consumble.rawValue,
IAPProduct.nonConsumble.rawValue]
let request = SKProductsRequest(productIdentifiers: products)
request.cancel()
request.delegate = self
request.start()
}
}
Delegate:
extension IAPService: SKProductsRequestDelegate {
func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
response.invalidProductIdentifiers.forEach { product in
print("Invalid: \(product)")
}
response.products.forEach { product in
print("Valid: \(product)")
}
func request(_ request: SKRequest, didFailWithError error: Error) {
print("Error for request: \(error.localizedDescription)")
}
}
}
Output
Where am I making a mistake?
The problem is that it seems your products are in the state of "Missing Metadata" in App Store Connect - they need to be in "Ready to Submit" for testing.
You're probably either:
Here's a good blog post that covers setting up products in more detail: Configuring In-app Products is Hard