Reasons for SKProductsRequest returning 0 products? Reasons for SKProductsRequest returning 0 products? ios ios

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 Purchasesenter image description here2) iTunes Connect -> Agreements, Tax, and Banking -> Master Agreements -> Paid Applications-> Contact Info / Bank Info / Tax Info (should be filled)enter image description here3) 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)        }    }}


Make sure you have In-App Purchase turned on in the Capabilities section. If you don't, SKProductsRequest will return 0 products.


I was facing the same problem, Solved it by sending just the IAP Product name rather than my bundle id before the product name. Here is the example :

worksSKProductsRequest *productRequest = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithObject:@"my_product"]];

rather than

doesn't workSKProductsRequest *productRequest = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithObject:@"com.my_site.my_app.my_product"]];