Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In App Purchase Products not found

I have created an app with bundle identifier

com.myapp

Now I added two In App Purchase items. Following are the product ids

com.myapp.product1

com.myapp.product2

Now when I fetch list of products, it does not show any product.

I use following code to load products list

  let request = SKProductsRequest(productIdentifiers: Set(remainingIds))
        request.delegate = self
        loadProductsRequests.append(LoadProductsRequestInfo(request: request, completion: completion))
        request.start()

The code works fine, If I use other project's product & bundle ids. But when I try for my project, it can't load list of products

It seems the issue is due to the structure of bundle identifier. Kindly help me.

like image 817
HarshIT Avatar asked Mar 23 '17 03:03

HarshIT


2 Answers

Your code seems proper to request the products.

Make sure you have added your products with bundle ids and other required details under iTunes Connect application under in-app purchase category.

One more thing - Apple will not allow receiving the product list from in-app until you fill the forms under “Agreement tax and Banking” on iTunes connect.

Below is the code to receive the product list which may helpful to you.

func productsRequest (_ request: SKProductsRequest, didReceive response: SKProductsResponse) {

        let count : Int = response.products.count
        if (count>0) {
            var validProducts = response.products
            var validProduct: SKProduct = response.products[0] as SKProduct

            if (validProduct.productIdentifier == self.product_id) {
                print(validProduct.localizedTitle)
                print(validProduct.localizedDescription)
                print(validProduct.price)
                buyProduct(product: validProduct);

            } else {
                print(validProduct.productIdentifier)
            }
        } else {
            print("nothing")
        }
    }

Here product_id = "com.myapp.product1" or "com.myapp.product2".

Also, enable the In-App purchase from Capabilities:

In-App Purchase

like image 193
Akash Thakkar Avatar answered Nov 08 '22 19:11

Akash Thakkar


In case of In-app purchase you have to do the following:

Login into iTunes Connect

Click “Users and Roles” and add “sandbox tester” Details to test the app with dummy payment • Click on “Agreement tax and Banking” Check For contract Type ,add needed account info,Bank info and Tax info. • On the iTunes Connect homepage, click the “Manage Your Applications” link • In the top-right corner, click “Create New Application” • Fill out all the requested information for your app. When asked for your application binary, check the box indicating you will upload it later.

It may take a day for you to get your desired list of products.

like image 3
Rekha.t Avatar answered Nov 08 '22 20:11

Rekha.t