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.
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 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With