Reasons for SKProductsRequest returning 0 products?

IosIn App-Purchase

Ios Problem Overview


I'm trying to set up IAP but after making a call to retrieve the products using SKProductsRequest the SKProductsResponse array within my delegate has a count of 0. Here's my checklist:

  • Test product has been added to iTunes connect
  • The product's bundle id matches the app bundle id (and its not using a wildcard)
  • The product identifier set in the SKProductRequest matches the product created on iTunes connect
  • I've waited several hours since the product was created on iTunes connect
  • The provisioning profiles enable IAP
  • Followed all steps in various tutorial such as http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/ etc.
  • Have deleted app from device, relaunched Xcode, rebuilt etc. etc.

Any other suggestions as to why the fetched product count is zero?

I don't believe this will be a coding issue, but here it is anyway:

…

NSSet *productIdentifiers = [NSSet setWithObjects:@"redacted", nil];
self.productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
self.productsRequest.delegate = self;
[self.productsRequest start];

…
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
    NSArray *products = response.products;
    NSLog(@"Product count: %d", [products count]);
    for (SKProduct *product in products)
    {
        NSLog(@"Product: %@ %@ %f", product.productIdentifier, product.localizedTitle, product.price.floatValue);
    }
}

Ios Solutions


Solution 1 - Ios

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)
         }
         
     }
    

    }


Solution 2 - Ios

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

Solution 3 - Ios

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 :

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

rather than

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

Solution 4 - Ios

I had the same issue...

> I simply change my bundle identifier which does not match with an > iTunes bundle identifier.

And my app runs well :)

Solution 5 - Ios

In the off chance that you've overlooked this, the product identifier match is case sensitive.

So, if you've created a product on Apple with an identifier of say

> com.yourcompany.product1

and you call the product request with a product identifier of

> com.yourcompany.Product1

Your list will be returned with zero products.

This kept me busy for a while :-)

ps: On a separate project, I found SKProductsRequest only started returning products after a restart. So, if all else fails, try restarting your Mac.

Solution 6 - Ios

IN swift 5, I am facing the same problem getting Skproducts count 0. I solved this Goto enter image description hereiTunes Connect -> Agreements and Tax if status is New there then there should be term view button besides status click it fill the complete form and then the paid apps will be shown status active and Skproducts counts would be visible in xcode console.

Solution 7 - Ios

Some times there are very carrying solutions to these types of problems. After doing some research, I found that it sometimes helps to delete the app and then install it again(https://stackoverflow.com/questions/8903078/in-app-purchase-skproductsrequest-returning-0-products-still-in-review) Also what version of iOS are you using?

Solution 8 - Ios

Let's go to iOS's Settings > iTunes & App Stores and Log out

Hope this help you, I don't know why :D

Solution 9 - Ios

Please also whether you have set price of the product in iTunesConnect or not.I missed that and products were zero.Wasted my whole day to figure out this.

Solution 10 - Ios

Also, keep in mind that agreeing to the Paid Applications cotract is not enough. You also have to fill out the contact, bank and tax information for that agreemant specifically, for it to be considered done.

Solution 11 - Ios

Below is a troubleshooting checklist for the case when SKProductsRequest returns zero products (source https://fluffy.es/zero-iap-products-checklist):

> 1. You must have a paid Apple developer account > 2. Your free and paid apps agreements status are active > 3. You have added the necessary Tax information > 4. You have added Banking information > 5. You have created an explicit App ID for your app > 6. You have created an app in App Store Connect, with the correct App ID > 7. You have created the in-app purchase item in App Store Connect > 8. Your in-app purchase product status is 'Ready to Submit' > 9. Your app is using the correct signing Team / provisioning profile > 10. Your app's bundle ID in Xcode is the same as App Store Connect > 11. You have added In-App Purchase capability to your app's Xcode project > 12. You are using the correct product ID when calling SKProductsRequest > 13. You have waited at least 15 minutes after creating In-App Purchase item Subscription to access all app content and content updates.

Solution 12 - Ios

After digging a lot, following steps solved my issue of getting 0 products for SKProductsRequest.

Go to Settings > Sign in to your iPhone on your iOS device. If you're already logged in with your original Apple ID, tap on it and choose Sign Out. Then simply sign in with the credentials for the sandbox tester you created in iTunes Connect.

Solution 13 - Ios

I'm getting an empty SKProductsResponse.products array on some macOS 10.14 systems while others work just fine and return the valid list of current IAPs for my app.

Same app, identical code.
User logged into the same App Store account on both machines.

That's just plain weird.

Solution 14 - Ios

In my case that was a bug. In simulator all product identifiers fails and was marked as invalid. In real device all product request successfully fetched a product.

TvOS 4K

Solution 15 - Ios

I had this issue even after accepting the Tax and Agreements Section in App Store. I use to change my Apps bundle Id many times(for sending builds to testers), I suspected this could be the issue. So I fixed this issue as follows.
Go to Target -> BuildSettings -> Search for "Product Bundle Identifier". It should be $(PRODUCT_BUNDLE_IDENTIFIER).
After updating this go to General -> Bundle Identifier. Enter your proper bundle Id which has In-App purchase capability. After doing this changes I'm able to list the products

Solution 16 - Ios

Swift 5 xcode 12.4 simulator returned zero products.

Using a physical device returned products properly

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGruntcakesView Question on Stackoverflow
Solution 1 - IosIvan BesarabView Answer on Stackoverflow
Solution 2 - IosElijahView Answer on Stackoverflow
Solution 3 - IosAhsan EbrahimView Answer on Stackoverflow
Solution 4 - IosiamVishal16View Answer on Stackoverflow
Solution 5 - IosnspireView Answer on Stackoverflow
Solution 6 - IosTalha RasoolView Answer on Stackoverflow
Solution 7 - IosvirindhView Answer on Stackoverflow
Solution 8 - IosTai LeView Answer on Stackoverflow
Solution 9 - IosDesert RoseView Answer on Stackoverflow
Solution 10 - IosMatjanView Answer on Stackoverflow
Solution 11 - IosRenarsView Answer on Stackoverflow
Solution 12 - IosMaverickView Answer on Stackoverflow
Solution 13 - IosATVView Answer on Stackoverflow
Solution 14 - IosNike KovView Answer on Stackoverflow
Solution 15 - IosBharathRaoView Answer on Stackoverflow
Solution 16 - IosCoderChickView Answer on Stackoverflow