Reasons for SKProductsRequest returning 0 products?

Check all 3 things in the list below
1) check your product identifiers – they must be exactly the same that you have in your code and in iTunes Connect -> My Apps -> YourAppName -> Features -> In-App Purchases
enter image description here
2) iTunes Connect -> Agreements, Tax, and Banking -> Master Agreements -> Paid Applications-> Contact Info / Bank Info / Tax Info (should be filled)enter image description here
3) code to test it

class ViewController: UIViewController {

    var requestProd = SKProductsRequest()
    var products = [SKProduct]()

    override func viewDidLoad() {
        super.viewDidLoad()

        validateProductIdentifiers()
    }
}

extension ViewController: SKProductsRequestDelegate {

    func validateProductIdentifiers() {
        let productsRequest = SKProductsRequest(productIdentifiers: Set(["candy100", "someOtherProductId"]))

        // Keep a strong reference to the request.
        self.requestProd = productsRequest;
        productsRequest.delegate = self
        productsRequest.start()
    }

    // SKProductsRequestDelegate protocol method
    public func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {

        self.products = response.products

        for invalidIdentifier in response.invalidProductIdentifiers {
            print(invalidIdentifier)
        }

    }
}

Leave a Comment