iPhone StoreKit - invalid product id's - iphone

I'm trying to test In App Purchase within the sandbox environment.
In order to test the code I did the following:
Created an In App Purchase Test User account under 'Manage Users' in iTunes Connect
Created some in app purchase products under 'Manage Your In App Purchases'. I used numeric values and alpha-numeric values for the Product IDs.
Loaded the app onto the iPhone, went to Settings->Store and logged out of the regular store and into the test account created in step 1
Set a breakpoint in the
(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
callback
All the submitted Product ID's are in the response.invalidProductIdentifiers property.
When submitting the request I first tried the exact Product IDs created during step 2. I also tried prefixing them with the Bundle ID:
NSString *id2 = #"com.super.duper.8";
NSSet *productList = [NSSet setWithObjects:id2, #"8", nil];
SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers:productList];
Am I missing something obvious?
Any help is appreciated.
Achim

If you are still getting invalid product ids, I've been accumulating a checklist of all of the various causes:
http://troybrant.net/blog/2010/01/invalid-product-ids/

I spent two days struggling with all my productsRequest (for AppID) ended up in response.invalidProductIdentifiers list, instead of in response.products list. Apple definitely did an F grade job in dealing with their storekit. It is confusing, intertwined and complex.
I did finally resolved it. One very important lesson I learned as indicated by few in the forums: It may take many hours for what you entered on the itunesconnect.apple.com to take affect.
There are two parts: application name and AppID in your xcode and what you entered in itunesconnection, they have to match exactly (case sensitive). If you registered or modified your in-App AppleID (I also completed all my contracts and bank information as suggested by some that the purchase actions won't work without getting this part done), you may as well go to bed before testing it again because it really takes hours in my case to take affect. I was so frustrated battling with this issue before my 9 year old dragged me for bed time story then surprised to find the issue disappeared when I woke up.
I found the suggestions by Eddy71 in http://www.iphonedevsdk.com/forum/iphone-sdk-development/21035-problems-creating-test-user-app-purchase.html really helpful. Before resolving it I did everything I possibly could do in Eddy's check list and still got zero products, one of my fears was that whether without uploading the binary code to complete the application registration in itunesconnect was ok (no need to go live as taught in http://blog.mugunthkumar.com/coding/iphone-tutorial-%E2%80%93-in-app-purchases/). It is indeed ok. Make sure the "cleared for sale" is check and in the icon is green (you need an extra step to approve it after filling out the form). The other fear was that whether I can use developer provisional (not distribution provisional) in debug mode, it is also indeed ok. I hope this may help some of you. Good luck and have faith. It will work eventually.

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.

it's OK that the phone is jailbroken, you just have to uninstall appSync in Cydia, then it works

Apple has a fantastic document which is not well known that covers this at the end. It also dispels some myths about things that don't help (eg. submitting a binary).
Technote 2259 "Adding In-App Purchase to your iOS and Mac Applications"

We ended up creating a new provisioning profile, there was a line somewhere (can't recall where, not in the docs for in app purchase) that stated that you have to enable in app purchase in the provisioning profile. We couldn't do that with our existing profile, so we created a new one and then we could enable it.

Try resetting the iphone settings and delete the app from iphone and use the request product id directly without the Bundle ID

For anyone else that has these issues, I highly recommend reading this thread on the Apple Forum.

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

In my case, I didn't complete the bank info, tax info, and contact info.Once I finish this, I can get my productID, hope this will help someone.

This is where you are going wrong, you need this in your code:
NSSet *productList = [NSSet setWithObjects:product id]
You can get this product id from iTunes connect.
And you need to make sure that you have created a test user, and have signed out of your original iTunes account. Please see do not sign in with test user account, regardless of what apple documentation says, just use it when a pop up appears.

What's that #"8" for? your product is named as com.super.duper.8 right?
http://blog.mugunthkumar.com/coding/iphone-tutorial-%e2%80%93-in-app-purchases/

Another issue I had was that I had to go to Window > Organizer in Xcode and delete my app and the provisioning profile(s) and re-add my development provisioning profile. I restarted the device and xcode as an extra measure.

I have tried every solution that available on the internet, and nothing worked, absolutely nothing. My problem: My device was jailbroken and had Cydia on it. I restored the device to factory defaults (Not jailbroken) and it worked the first time and returned the product ID no problem.

For me the problem was that I had chosen "Turn on Content Hosting" when set up the In-App purchase. So I had to turn it off and the problem was resolved.

It takes the store some time to make the products available to all server (see documentation). So you might experience a delay between creating a product in iTunes Connect and seeing that product id as a valid one when testing on device. For me it took around 12 hours till my products showed up.

A note for others: do not use an NSMutableSet for the product IDs. It has to be an NSSet!

If you want to keep your app data but you want to try deleting your app to fix this issue, sync your device first. Then delete your app and reinstall from Xcode -- this fixed the issue for me. Once it's working, you can restore your device from its backup -- this only takes a few minutes and the product requests still work after the restore.

Not exactly sure why, but when I changed the request's product ID from 'com.mycompany.myapp.product' to 'product' it started working. Maybe it's because of how I have the product configured in iTunes Connect.
Give it a try, might work for some of you...

replace:
NSSet *productList = [NSSet setWithObjects:id2, #"8", nil];
with:
NSSet *productList = [NSSet setWithObjects:#"8", nil];

Another problem that might be. If the name of your xCode project is not written of English, or has other characters in it, bundle ID will have "------" where the name of your app should be. I thought it is just a convention for bundle id, to have this in xCode. Turns out, this was my problem, so name your xCode project on English ) I know this is not the case for the most, but anyway)

I tried everything everyone is talking about. I ended up making a guest account first to see if the product ID could be found.... It was. So then I started quitting everything in activity monitor and found the problem. I had to quit the "store" processes below. All of a sudden I stopped getting the invalid product ID. Hope that helps someone out there.

Related

iOS in-app purchases skproductrequest randomly getting no products returned

I have an odd problem on my hands with in-app purchases and any insight or help would be appreciated. I have in-app purchases setup for my app and have been using them regularly during testing; however, every once in a while the SKProductRequest will return with 0 products and won't load any products until I completely remove the app from the device and re-install it. Then everything shows up again and purchases can be made.
I'm not sure what is causing this problem. It may have something to do with the test environment for in-app purchases? I know everything is configured correctly seeing as I can normally use the in-app purchases without any errors. Thanks for any help.
There may be several causes to Product Requests failing on a device. Basically, the StoreKit environment is very picky: if something in the app seems weird (like the code signature, or the embedded Provisioning Profile, or multiple app with the same profiles), it will not sent the request, or receive invalid data.
A common cause of silent failures is having multiple Provisioning Profiles installed for the same app. You can try to:
Uninstall all Provisioning Profiles from your device (in Settings),
Remove the app from the Device (to remove the embedded Provisioning Profile),
Re-install the app.
I wrote a small blog post about this issue a few months ago, you may find more detailed informations there : http://kemenaran.winosx.com/?2011/12/02/180-ios-developer-what-to-do-if-in-app-purchases-stop-working

In app purchases with MKStoreKit failing: "Problem in iTunes connect configuration for product: xxx"

I'm trying to implement in app purchases in my App using MKStoreKit. I've followed all the steps and I'm getting the error:
Problem in iTunes connect configuration for product:
I've recreated the provisioning profiles, checked the product id is the same as in itunes connect, sent and rejected a binary, trying to delete everything and set it up again and nothing is working.
Any idea?
I know this is a late reply, but somehow I could not find the answer to this problem elsewhere so I decided to post my experience in hopes it might help other frustrated people with this issue.
I have recently added an In-App purchase to my Free app and I faced the same problem during the testing phase and also once it was launched on App Store.
The answer is Patience. For some odd reason, after doing everything correctly, you need to wait for around a day before your product is recognized. So once you finish your Manage In-App product ID, you will only see it working the following day - so don't delete and recreate it again - just wait.
Furthermore, after submitting your app for approval with the first In-App product, even when your app is approved and available in the App Store, the In-App might not work at first and you will feel you did something wrong. Wait another day or so, and magically, it will start to work.
It didn't work in my case cause the phone was jailbroken. After restoring it worked like a charm.
my ipad was jailbroken. it was given this "Problem in iTunes connect configuration for product: xxx" i changed my ipad with regular(no jailbrek) ipad and it's working now.

How to transfer application into device when testing inapp purchases

I found this information on a blog which talks about invalid product ids.
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.
Obvious, right? Well, if you are
working with an update to an existing
account, the device will still treat
it as an App Store-installed app.
Delete it, then transfer it again. It should work now :)
i am also getting invalid product ids.i am not able to get clear in the above said point...
i am not able to understand what i need to do when transferring the application into device...
Kindly guide me out and thanks for your help
That point just means that you need to run the app from Xcode in order for the sandbox to be available. (Build and Run)
Invalid product ids are a major pain to debug. If you're sure you've gotten everything on that checklist, then you just need to wait. Then only other problem that I've seen is that you might need to remove the app from the device and redeploy in order to get good products back from the store.
I had trouble getting the app store to recognize my sandbox test account. I had to log out wit iTunes, sync, then log in again with iTunes. Just using the device itself to log in/out didn't help.

No eligible bundle identifiers submission error

I just went to submit my first app involving iAds, and in the beginning of the app submissions process there is a new button to "Enable iAds". I click and get the following error:
"You have no eligible bundle identifiers. Please register one here."
So i went to my provisioning portal, expecting to see a configure iAds option similar to GameKit, in app purchase, etc; but no dice. What gives?
Btw, my iAds network contract is in place with the nice green checkmark of completitude. Can anyone tell me what I'm missing?
You need to create a unique App Id in this case to add iAd functionality, like com.yourcompany.yourappname in the dev provisioning centre. Look up creating unique App Id there are many resources. This will give you the necessary bundle identifier.
Make sure your AppID is not using a wild-card bundle. While the provisioning portal does not mention iAds explicitly, it does mention that wild-card App IDs can't be used for push notifications or in-app purchases, and I do have the sneaking suspicion the same limitation applies to the iAd network as well.
I' having the same issue with a new app I'm trying to upload today. But here are my inputs:
1 - I have a family suite of apps (about 48) called "You Know You Are" (ie: You know You Are a Guy, You Know You Are from Miami, etc). Each have their own unique appID. Out of those 48 only ONE of those appear in ENABLE iAD section.
2 - I have another set of app call "How Long Can You" (ie: How Long Can You Tap It and How Long Can You Turn It). I never created a unique appID for these. The app bundle DOES have each of them unique(com.site.tapit, com.site.turnit) and the Distribution profile I sign it with with the wildcard profile. When I went to update those apps yesterday, they DID show up. No typo here, I double checked, YES I did say that I WAS able to enable iAd for those two apps.
I was reading a bit on why only one my other family apps appear in the list. I came across this thread and decided to add my 2-cents, more like 1-and-a-half-cents since I feel none of this makes sense ;)
Also, I decided to follow instructions and I just added a new AppID for a new app I want to upload and I still do not see it in the list.
Hope this sheds some light to help fix/diagnose what is going on.

How to test In App purchase again and again and again...?

My in app purchase project working perfectly now, but I need to test purchasing and when once purchase is successfully done it cannot be undone? How can I test in app purchasing and upgrading my app to full version when it can be done just one time?
Delete the app from your device
Run "Clean" from the Product menu in XCode
On your device, go to "Settings", "Store", "Apple ID", and Sign Out
Start your app again, since you're not signed in to any account, the previous in-app purchase will not be recognized and you'll be able to buy it/download it again with the same test user account
None of the answers is really correct. Even if the you remove the cached purchase from your testing device, the product is marked as bought in Apple's server, associated to your test Apple ID. So the testing will not exactly reproduce the expected behavior. This is very important for testing the restore products function use cases, for example.
As far as I know, the real answer to this question is: You can't without creating a new test account, but that's not a really big deal, you can even use an invented email address (no need to validate it), and you can delete the account after using it.
If you delete your app and reinstall it, you can repurchase products. It follows the same code flow and nearly exactly the same user experience (there is a dialog letting you know that you can repurchase for free the second time). Also you can create more test users in iTunes Connect to be sure that you are doing completely clean testing.
I've spent several weeks deleting and reinstalling my app many times per day to ensure that my storekit implementation works just like I want it too.
All you have to do is delete your app from the device. This will wipe out any NSUserDefaults where you may have stored in-app purchase details.
Once you run your app again, make the purchase one more time, and Store Kit will tell you this:
"You've already purchased this. Tap OK to download it again for free"
Once you tap OK, you go through the same sequence of events you did when you made your first in-app purchase, so you can test again and again.
Use unit tests on your app, with false data, until you're satisfied.
(create test code - for each module you use)
I think I'll need more description of your process to have a better answer.