iPhone StoreKit - invalid product id's

Viewed 30700

I'm trying to test In App Purchase within the sandbox environment.

In order to test the code I did the following:

  1. Created an 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'. I used numeric values and alpha-numeric values for the Product IDs.

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

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

22 Answers

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.

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

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.

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.

Related