InAppPurchase invalid product identifiers - Possible Reasons
In my case the problem was that I had previously created "StoreKit Configuration file" and then made change in Product Scheme:
Go to Product > Scheme > Edit Scheme and in Run/Debug tab under Options I chose StoreKit configuration file.
Apparently this config was used instead of my App Store Connect IAP. So, the solution was to uncheck that option. You don't have to delete StoreKit Config file if you still need it for some reason.
Please make sure you have not missed anything from below list.
Please remove the Existing application from the Device and Install the fresh build from Xcode.
Have you enabled In-App Purchases for your App ID?
Does your project’s .plist Bundle ID match your App ID?
Have you generated and installed a new provisioning profile for the new App ID?
Have you configured your project to code sign using this new provisioning profile?
Are you using the full product ID when making a SKProductRequest?
Have you waited several hours since adding your product to iTunes Connect?
Are your bank details active on iTunes Connect?
Is your device jailbroken? If so, you need to revert the jailbreak for IAP to work.
If you answered No to any one of these questions, there’s your problem.
Please refer Reference
My paid applications agreement wasn't valid in iTunes Connect. As soon as I agreed to the new one, it fixed the problem.
I don't know how, and don't know will it remain valid. But here is the interesting solution which let me solve my problem.
According to the documentation, SKProductRequest should be;
SKProductsRequest *productRequest = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithObject:@"com.my_site.my_app.my_product"]];
Your product request should be like this;
com.my_site.my_app.my_product
but in my situation I just sent my product id, just like this and it WORKED;
SOLUTION #1
SKProductsRequest *productRequest = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithObject:@"my_product"]];
While digging in, I found that for some people this notation also worked;
SOLUTION #2
SKProductsRequest *productRequest = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithObjects:@"com.my_site.my_app","my_product",nil]];
There was nothing wrong with my setup, and the above listed things should be supplied, if anyone having problems with invalid product identifiers, I recommend them to visit Troy Brant's "Cause of Invalid Product ID's List", here . Also you can find his detailed walkthrough about implemeting and setting up IAP, here.
If you get desperate, I strongly recommend you to try both solutions, and they can save you from hours of frustration.