购买无效的产品标识符

我从 SKProductsRequest得到一个产品标识符的空数组。

我做了以下步骤:

  1. 在 iTunes Connect 的“管理用户”下创建一个 In App 购买测试用户帐户

  2. 在“管理你的应用程序购买”下创建了一些应用程序购买产品。

  3. 将应用程序加载到 iPhone 上,进入设置→商店,然后退出常规商店

  4. (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response回调中设置断点

所有提交的 Product ID 都在响应的 invalidProductIdentifiers属性中。在提交请求时,我尝试了在步骤2中创建的 Product ID 以及那些带有 Bundle ID 前缀的 ID。

先说声谢谢,

拉古

57419 次浏览

Did you log out of the AppStore from Settings.app? Only when you log out, you will be prompted for logging in again.

Is In-App purchases enabled for your App ID? App ID with wild card (*) cannot be enabled for In-App Purchases. For your app, you should create a new App ID.

My two cents here: http://blog.mugunthkumar.com/coding/iphone-tutorial-%e2%80%93-in-app-purchases/

Make sure your "Product Name" in xcode is the same as the app submitted to iTunes Connect.

The contract for paid applications must be in effect in order to receive data about the in app purchases configured.

This worked for me. I had the exact same problem.

Is your In App Purchase "Cleared for Sale"? That's the setting that I didn't check first time.

Setting the Product Name to the same name submitted to iTunes Connect solved it for me.

I've been compiling a list of the reasons product identifiers come back invalid. Here's a checklist of the potential causes:

http://troybrant.net/blog/2010/01/invalid-product-ids/

I tried everything suggested in the Apple forums and here, and still couldn't get it to work.

Found the solution:

Your app needs to be transferred by Xcode for the sandbox to be enabled.

Your app needs to be built and installed locally by Xcode, not downloaded from the App Store.

Obvious, right? Well, if you are working with an update to an existing application, the device will still treat it as an App Store-installed app.

So delete the app from your device. Then install the app back onto the device using Build & Run with your device tethered to your Mac. It should work now :)

I'm one the the victims here. Well, I was. Yesterday, I had the problem and revised a lot of times all the steps. Today, I reviewed all the list from troybrant.

  1. ok my mistake, I forgot to create the proper distribution profile:fixed

  2. uploaded a binary and rejected immediately: they say it works better than no uploading

  3. ok, other fix: removed the 10 digits before my domain name from everywhere in Xcode (XXXXXXXXXX.com.company.app to com.company.app)

Still not working.

  1. Check my device not to be connected with an iTunes account.

  2. Clean build every time and remove app from device sometimes

Still not working.

  1. Finally, when asking for products, I used only the productID, not the whole com.company.app.productID.

AND it worked.

I think sometimes we have more than 1 mistakes, and when you correct all of them, it's hard to know what was exactly the cause of the problem.

Now I'm happy

After struggling for a day or so with invalid products being returned, my solution came down to making sure the purchase item was "Developer approved for sale". Even though there was a green mark next to the item saying "cleared for sale", I still needed to upload a screenshot and select approve.

This seems like a backwards and illogical way of doing things considering I'm still testing my app and not yet ready to put it on sale.

I discovered today another thing that can cause this sort of problem. Some times, for strange reasons, the app gets corrupted and all tries to buy something end in error. I solved my problem deleting the app from the device, cleaning the build on Xcode and building it again to the device.

I found that if your application has a different title in another language then you will have this problem unless you set your iPhone language to English. It only happens in development; there doesn't seem to be a problem for production.

My problem was the first issue described here:

https://devforums.apple.com/thread/23344?start=0&tstart=0

"First, you need to make sure your app-id in the Portal is correct."

I have 15 non-consummable products.

Suddenly, all 15 of them started to appear as 'invalid' in one of my devices (iPod Touch 4G), but valid in the other (iPhone 4S); very weird indeed.

I deleted/reinstalled and now it works OK.

Someone said you must launch from Xcode, but this is not necessarily true. I have many beta testers with AdHoc builds and Test User accounts, and most of the time they seem to be able to purchase OK.

That said, the whole Sandbox Environment is always shaky and has plenty of "down time". Sometimes waiting is the answer.

It seems people are getting confused on Product IDs.

You DON'T need to add the whole domain (ex. com.company.product.inappname) for InApp to work.

You MUST use the EXACT Product ID you create on iTunes Connect. In my case, I just created "Product1", used this when SKProductsRequest is called and that's it.

No more pain.

This link has plenty useful information, though is missing this small detail: http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/

Besides everything posted in this topic, I just installed the right debug provision profile, deleted the application from my iPhone, restarted my device and bang, got the product info.

I tried this after getting the product info through the simulator (with the latest Xcode now it is possible). I was about to upload the binary and then reject it, but then I tried the above and got it. Hope it helps!

Our issue was the last bullet point from Apple's FAQ, "Why are my product identifiers being returned in the invalidProductIdentifiers array?":

  • You did not complete all the financial requirements (see the "Contracts, Tax, and Banking Information" section of this document).
  • You did not use an explicit App ID.
  • You did not use the Provisioning Profile associated with your explicit App ID.
  • You did not use the correct product identifier in your code. See Technical Q&A, QA1329, 'In App Purchase Product Identifiers' for more information about product identifiers.
  • You did not clear your In App Purchase products for sale in iTunes Connect.
  • You might have modified your products, but these changes are not yet available to all the App Store servers.
  • If you or App Review rejected your most recent binary in iTunes Connect.

I changed the most recent version (which had been rejected) to "Waiting for Upload" by clicking "Ready to Upload Binary" in iTunes Connect and the problem was resolved after about 10 minutes.