In-App Purchase returning 0 products and invalidProductIdentifier
I was just checking and my:
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
returned a SKProducstResponse with a products array size of 0. Why is this? If it can't find the product it should return a 0 right? I checked the product ID and it matches the one I have in my itunes connect. Checked the bundle identifier and it matches as well.. And yes, I tested this on a device
UPDATE:
I checked the
response.invalidProductIdentifier
and it returned the productID that I was trying to fetch. I went through this list:
• your app is InApp Purchases enabled? **yes**
• do you have an InApp Purchase test account? **yes**
• the product we offer is marked as "Cleared for Sale"? **yes**
• Did you upload the application to iTunes Connect? **no** (don't think it's necessary since 2011, correct me if I am wrong)
• do you generate and install a provisioning profile for th开发者_如何学编程e new "App ID"? **yes**
• Does your project is signed with the new provisioning profile? **yes**
• Are you compiling the project for IOS 3.0 or higher? **yes**
• Are you using the full product ID when you make a SKProductRequest? ie for example: com.company.sampleapp.productid? **yes**
• Has it been several hours since you added the products to iTunes Connect? **yes**
• Does the contract payment application in the iTunes Connect is complete? **just submitted it**
Should I actually have the paid contract in effect in order to have the IAP running?
Referring to your post:
• Are you using the full product ID when you make a SKProductRequest? ie for example: com.company.sampleapp.productid? yes
Actually you need to specify exactly the string (productId) you entered in iTunes Connect as the In-App purchase item. So if you specified productId
, your SKProductRequest needs to have exactly that string set (without any com.a.b.). If you have specified in iTunes something like com.a.b.item
(which is recommended), that is what you need to set in full in your Product Request.
EDIT The post In-App-Purchase points out, that the paid applications contract must be in effect to allow in app purchases. So it might be cause for your issue.
I had the same problem, and resolve it by following:
- Go to iTunes connect > Agreements, Tax, and Banking
- Check the "Paid Applications" contract
- I have set up Contact Info, Bank Info, Tax Info
- After filling the above detail, Contract status changed to "Pending"
- It will take around 30 minutes to change contract status to be ready
That's it. now I will get the product list from the following delegate.
func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse)
Note: Before complete above steps, I can see my product id in SKProductsResponse.invalidProductIdentifiers list in above delegate method.
精彩评论