86

I am getting an empty array of product identifiers from SKProductsRequest.

I did the following steps:

  1. Created a In App Purchase Test User account under 'Manage Users' in iTunes Connect

  2. Created some in app purchase products under 'Manage Your In App Purchases'.

  3. Loaded the app onto the iPhone, went to Settings → Store and logged out of the regular store

  4. Set a breakpoint in the (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response callback

All the submitted Product ID's are in the response's invalidProductIdentifiers property. When submitting the request I tried both the Product IDs created during step 2 as well as those IDs prefixed with the Bundle ID.

Thanks in advance,

Raghu

Jean-François Fabre
  • 126,787
  • 22
  • 103
  • 165
Sridhar Bollam
  • 1,174
  • 1
  • 12
  • 19
  • Please view my answer in http://stackoverflow.com/questions/1041656/iphone-storekit-invalid-product-ids – Wayne Lo Jan 23 '10 at 14:13
  • 2
    I can't believe this happened for me, but my problem was that I was using the Reference Name instead of the Product ID! Stupid me! – Mona Nov 14 '12 at 23:31
  • I'd like to add the like @masone, I believe my initial issues with in-app purchases were related to the client not having completed the Paid Applications contract – james_womack Jan 12 '10 at 18:56
  • @Mona Can you give examples of the difference, to help others. – Joshua Pinter Aug 05 '16 at 14:20

16 Answers16

175

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 :)

pkamb
  • 26,648
  • 20
  • 124
  • 157
Héctor Ramos
  • 9,163
  • 5
  • 33
  • 38
  • 1
    I am so glad you posted this answer. Thank you!!!1 – Andrew Garrison May 14 '11 at 03:24
  • 19
    I want to make 10 new accounts and upvote this 10 more times. – phi Jun 09 '11 at 13:36
  • 9
    Someone should give this man a medal – suda Jul 19 '11 at 13:07
  • 2
    OMG, I can't believe how stupid I am. Five months later and I had forgotten about this answer. Googling it again and landing here again. I feel like Doris in Saving Nemo. Hector, you are my hero. – PEZ Aug 09 '11 at 10:17
  • 5
    excuse me, what do you mean by transfer the application by Xcode? upload it again to the device, to the AppStore? I created a placeholder with in app purchase items, the application is still not ready to be uploaded to AppStore. I keep getting invalid product ids.I work with debug version. – Nava Carmon Aug 27 '11 at 18:44
  • 1
    Transfer it to your device by plugging it through USB to the computer running Xcode and doing a Build and Run. The bug only occurs if you have already submitted the app to the App Store and subsequently installed the App Store build on the device. – Héctor Ramos Aug 27 '11 at 20:34
  • I run the debug version, which is signed with my developer certificate and Team Provisioning Xcode profile. May be this is a problem? And my in-app purchase items are in Waiting For Review status. Should they become Ready For Sale in order to check them? – Nava Carmon Aug 27 '11 at 21:03
  • Yes, they should be Ready for Sale AFAIK. It's been a while since I've worked on this but I think I only tried it after they were approved. And remember to log out from the App Store and use your test Apple ID when purchasing the items. Back then Xcode didn't have Team profiles, so to be safe, try specifying the provision profile that has in-app purchase enabled? – Héctor Ramos Aug 28 '11 at 06:00
  • When you say transfer the app, are you talking about adhoc distribution, release (which you can't do) but I thought adhoc cannot go through iTunes connect process? You can only send releases? Can you clarify this? – zardon Oct 27 '11 at 11:46
  • You guys are over-analyzing this. You get the error when you debug your app on the device - it's tethered to your Mac. By transfer, I meant you should build and run the app on your device, using Xcode, while the device is tethered. That's it. Any other issue related to ad hoc distribution is not covered under this question, necessarily, although you might run into a similar issue by installing an ad hoc build over an App Store build. – Héctor Ramos Oct 28 '11 at 17:48
  • 2
    Haha thanks. Here I am doing final testing before submitting my app to ensure my CoreData migration works well from the live version and I run into this issue. Your answer was a huge relief ;) – awolf Dec 06 '11 at 07:22
  • 4
    Yes i think that medal is in need – James Dunay Mar 21 '12 at 16:36
  • 2
    Worked for me as well!! Omg I spent hours trying to solve this! – Tom van Zummeren Jul 01 '12 at 12:27
  • 2
    Thanks :) Your answer solved my problem after millionth try. – Samet DEDE Aug 08 '12 at 11:56
  • 1
    Thanks, big help. I actually think this is more about the logged in store user when the application was installed than whether it was downloaded from the Store. I had the same problem on an app that I'd deployed to the device using Xcode, and deleting/redeploying didn't help until after I had signed out of the store. – FlintZA Aug 10 '12 at 16:08
  • If you want to keep your app data, make sure you back up your device before deleting your app. Then run the app from Xcode to make the in-app products appear, and then restore your device from the backup. It's an annoying process, but seems to be the only way. – arlomedia Sep 06 '12 at 01:27
  • @HectorRamos could you take a look at my question that looks similar to this but I can't figure out yet by having tried everything suggested, http://stackoverflow.com/questions/23970650/why-cant-get-the-product-identifier-that-is-being-for-sale-after-app-release-to, thanks! – S1U Jun 01 '14 at 03:16
  • This also applies for Mac App Store apps. Wasted an hour on this before I read this, deleted the existing app, deleted its plist, RESTARTED THE COMPUTER. Then, it worked. – ecume des jours Jan 04 '16 at 17:11
  • 1
    what do you mean by "your app needs to be transferred by Xcode for the sandbox to be enabled" what should I do . can you give more details? – Neko Aug 20 '17 at 17:44
  • When you use the simulator you get this error. Use your iPhone, iPad instead and start the app via the run button from XCode. – Hans Bondoka Nov 25 '20 at 11:35
71

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/

Troy Brant
  • 2,521
  • 1
  • 17
  • 6
  • 5
    "Have you tried deleting the app from your device and reinstalling" You nailed down my problem! Thanks – Piotr Czapla Feb 14 '11 at 17:29
  • Thanks a lot for the list!! Found my reason: device jailbroken :( – Damian Sep 21 '11 at 05:12
  • 1
    Whoah, you're Troy Brant! Thank you for the blog articles. In MY last 24-hours, you were just about the most famous person on Earth... though 90% of users' comments on the blog post are absurdly wrong. – Dan Rosenstark Oct 05 '12 at 07:22
40

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.

21

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

pkamb
  • 26,648
  • 20
  • 124
  • 157
LRM
  • 211
  • 2
  • 2
  • That's seriously strange. Apple says any product id will work. This seems to imply that the com.conpany.app part is required? – PEZ Jan 09 '11 at 12:32
  • 4
    Confirm that using ONLY the product ID (step 6) worked for me too when all else failed. – Steve N May 22 '11 at 14:01
  • 1
    step 6 worked for me. I was using the full com.company.x and was scratching my head why it wasn't working. – Cocoanut Aug 28 '11 at 03:59
  • which profile i need to use for step 2 ??? distribution or developer ?? Can i have same bundle id for both ?? – harshit2811 Nov 03 '11 at 10:42
  • wtf. in my last app i needed com.company.app.product (i tried with just product, didn't work). now in a new app, it works with product only, and not the com.company.app.product was apple says to use...weird. – Marty Dec 15 '11 at 00:54
  • Wow! after days of debugging I found the solution: Earlier I was using BundleID.ProductID format but it didn't work. Then I removed Bundle ID and used only Product id and it worked. It's sad that this Answer is not at the top. People try every possible thing first and they come to this very late. I wish I can give 500 up votes!! to make this answer reach top of the page. It will save people hours of headache :) – Saurabh Hooda Sep 05 '13 at 19:26
  • Pffft thank you! You saved me from countless hours too. Weird that all tutorials say the format of `com.company.app`. This should be clarified by Apple's docs – Thermometer Dec 19 '16 at 14:16
  • step 6 works for me. – Ray Jun 29 '17 at 01:25
  • I think the confusion here may be that if you incorporate your bundle id IN your product ID, then it's just the product ID – Doug Mead Aug 11 '17 at 23:34
  • Hii. all Step 1,3,4,5,6 are completed but in step 2 is needed to upload app in app store? i don't upload app to app store... and still i am getting product id invalided – Harshad Patel Nov 01 '18 at 14:05
19

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.

Phil Calvin
  • 4,897
  • 2
  • 37
  • 34
  • that FAQ is missing from the current version of Technical Note TN2259 :/ – pkamb Oct 17 '19 at 21:23
  • 1
    But the same bullet points [are listed in the `invalidproductidentifiers` API docs!](https://developer.apple.com/documentation/storekit/skproductsresponse/1505985-invalidproductidentifiers) – pkamb Oct 17 '19 at 21:43
  • You did not complete all the financial requirements (see the "Contracts, Tax, and Banking Information" section of this document). --> This was the issue for me – Shoaib Bagwan Sep 03 '20 at 14:44
13

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/

Colnaghi
  • 481
  • 5
  • 9
  • The Product ID is what is confusing and was problem for me too. Lost time due to silly mistake – VijayKumar Jan 05 '15 at 13:34
  • 1
    Really useful post and link helped me, it was necessary to create development provision profile, and I only had distribution. – GenRiH Oct 19 '17 at 12:09
2

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/

pkamb
  • 26,648
  • 20
  • 124
  • 157
Mugunth
  • 14,355
  • 15
  • 64
  • 94
2

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."

morgancodes
  • 24,113
  • 35
  • 128
  • 186
1

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

Stephen Darlington
  • 49,617
  • 11
  • 101
  • 147
1

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

aegzorz
  • 2,199
  • 14
  • 18
1

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.

1

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.

Duck
  • 32,792
  • 46
  • 221
  • 426
  • Very strange, exactly the same worked for me. – LeonS Aug 17 '11 at 07:50
  • after this date I had this problem again, but way deeper. I had to wipe my iPhone and reinstall it all over again. Not a single problem after that. – Duck Aug 19 '11 at 18:59
1

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.

Sjors Provoost
  • 1,881
  • 19
  • 33
1

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.

Nicolas Miari
  • 15,044
  • 6
  • 72
  • 173
  • 1
    Did you reboot after reinstalling? I needed to do it. I had one iPod touch which worked with IAP's, and two iPads that did not. Deleting the profiles and the application, REBOOTING and then launching from xCode did the trick. Without reboot it did not work. – snlehton Oct 08 '12 at 13:30
  • 1
    By 'reboot' you mean the device, the development machine, or both? – Nicolas Miari Oct 09 '12 at 06:17
  • +1 for rebooting. I was coding for the Mac App store and I changed the bundle ids on a target. After building and running, the app would only get the product IDs from the old bundle id, even though NSLog showed it was using the new one. Clean build + delete derived data -> still nothing. Finally, clean build + delete derived data + reboot, got the app to fetch the product ids from the new bundle id. – Rog182 Jan 16 '16 at 00:09
1

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!

pkamb
  • 26,648
  • 20
  • 124
  • 157
Wolf
  • 11
  • 1
0

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