Reasons for SKProductsRequest returning 0 products?

后端 未结 14 2660
粉色の甜心
粉色の甜心 2020-12-25 09:28

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

相关标签:
14条回答
  • 2020-12-25 10:10

    IN swift 5, I am facing the same problem getting Skproducts count 0. I solved this Goto iTunes 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.

    0 讨论(0)
  • 2020-12-25 10:12

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

    0 讨论(0)
  • 2020-12-25 10:13

    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"]];

    0 讨论(0)
  • 2020-12-25 10:13

    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.

    0 讨论(0)
  • 2020-12-25 10:18

    Initial answer

    Have you got your contract, banks, etc info setup?

    Corrected answer

    It seems I'm wrong about this. Take a look at In-App Purchase, SKProductsRequest returning 0 - Products still in Review

    0 讨论(0)
  • 2020-12-25 10:18

    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.

    0 讨论(0)
提交回复
热议问题