StoreKit - All product ID's are invalid. Why?

So I've gone in and out of forums looking at different issues.. I followed all of the steps that have been laid out in each example and took the most sensible bits from each post.

so here's the data i'm working with (obviously changed a bit, but still the same idea)

*created test in-app purchasing user*
*settings->store Account IS the test user created*
Bundle ID: com.example.app
Product ID: com.example.app.brv4w (Status: pending developer approval)
App ID: 3X4MPL3.com.example.app
Enable In App Purchase: CHECKED

SKProductsRequest *myProdsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:@"com.example.app.brv4w"]];
myProdsRequest.delegate = self;
[myProdsRequest start];

-(void) productsRequest: (SKProductsRequest *) request didReceiveResponse:(SKProductsResponse *) response {

in here [response.products count] is 0 and [response.invalidProductIdentifiers count] is 1

I can not figure out how to make [response.invalidProductIdentifiers count] 0 and [response.products count] 1. If anyone has any ideas, please let me know..

Message was edited by: Jason Swaby

Core 2 Duo 2.5ghz, Mac OS X (10.5.8), iPhone 3G

Posted on Aug 19, 2009 9:47 AM

Reply
17 replies

Sep 4, 2009 9:43 PM in response to WoodmanTX

OK, so by shear chance and a solid bruise on my forehead, the answer came to me. You have so pass in the product IDs that you defined as in-app purchase products in iTunes Connect. You do this in the NSSet you are passing. Here is an example of my code:

NSSet *productIDs = [NSSet setWithObjects:@"com.companyname.productname.productOne", @"com.companyname.productname.productTwo", nil];

SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:productIDs];

This worked like a charm. Now to the rest of the code to set up the UI and do the rest of the StoreKit testing. I hope this helps you, or someone else.

Scott

Message was edited by: WoodmanTX

Sep 9, 2009 10:38 AM in response to Jason Swaby

Hi,

I am facing same problem (getting response.products count is 0 and response.invalidProductIdentifiers count is 1)

I have enabled inApp purchase for one of my paid apps and created a new inApp purchase with
ProductID: com.company.productXYZ.feature123 (Status: pending developer approval)

Can you let me know if I have to give this in SKProductsRequest *myProdsRequest.
or
I have to give the app (productXYZ here)'s Product ID.

Can you also let me know how I can get Product ID for my app (productXYZ).



Many Thanks,
Svaths

Sep 9, 2009 12:11 PM in response to Svaths

I got mine working by specifying the whole product ID in the query. Here is some sample code:

NSSet *productIDs = [NSSet setWithObjects:@"com.companyname.appname.feature1", @"com.companyname.appname.feature2", @"com.companyname.appname.feature3", @"com.companyname.appname.feature4", @"com.companyname.appname.feature5", nil];

SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:productIDs];
request.delegate = self;
[request start];

Let me know if this doesn't get you going...

Sep 9, 2009 3:18 PM in response to WoodmanTX

Hi,

I am having similar problems.
In the response I am getting "null".
Bundle ID : no.teknograd.donate
Product ID: no.teknograd.donate.prod1
Product ID: no.teknograd.donate.prod2

This is my code:
- (void) requestProductData
{
NSSet *productIDs = [NSSet setWithObjects:@"no.teknograd.donate.prod1", @"no.teknograd.donate.prod2", nil];
SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers:productIDs];
request.delegate = self;
NSLog(@"requestProductData");
[request start];
}

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSLog(@"productsRequest");
NSArray *myProduct = response.products;
NSLog(@"Product count: %@", [myProduct count]);
// populate UI
for(int i=0;i<[myProduct count];i++)
{
SKProduct *product = [myProduct objectAtIndex:i];
NSLog(@"Name: %@ - Price: %f",[product localizedTitle],[[product price] doubleValue]);
NSLog(@"Product identifier: %@", [product productIdentifier]);
}
}

Thanks in advance!

Sep 9, 2009 3:26 PM in response to fdqps

In your productsRequest method, you are missing several square brackets. Here is what your code should look like:

* (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response

{
NSLog(@"productsRequest");
NSArray *myProduct = response.products;
NSLog(@"Product count: %d", [myProduct count]);
// populate UI
for(int i=0;i<myProduct count;i++)
{
SKProduct *product = [myProduct objectAtIndex:i];
NSLog(@"Name: %@ - Price: %f", [product localizedTitle], [[product price] doubleValue]);
NSLog(@"Product identifier: %@", [product productIdentifier]);
}
}

Let me know if that doesn't work.

Sep 10, 2009 7:09 AM in response to fdqps

Sorry, without having your code to debug on this is going to be tough. Getting null does not sound like you are getting zero products returned (I would expect a count of 0, not null, in that case) so it sounds like your app/bundle IDs and products may be set up OK. It sounds more like you are simply missing a step in your code to get those products. I am not sure what else to tell you.

Sep 10, 2009 10:52 AM in response to WoodmanTX

Hi again

In the didReceiveResponse method I am getting something back from Apple it seems.
It added NSLog(@"invalidProductIdentifiers: %@", response.invalidProductIdentifiers); and this gives me:
Response: (
"no.teknograd.donate.prod1",
"no.teknograd.donate.prod2"
)

So I am suffering from invalidProductIdentifiers illness.

Is there any demo product ID's I can connect to to see that my code is working? Would make life easier if I could pin doen if the problem was in my code, or in my product setup.

Sep 10, 2009 11:06 AM in response to fdqps

That sounds distinctly like a product setup problem. Are you sure the products (the in-app products, that is) have "no.teknograd.donate.prod1", etc., as their product ids? It took a few tries for me to get this right too. For me, the bundle id in my info.plist didn't match the app as I defined it in iTunes Connect. Long story as to why, and I doubt you have the same problem, but my point is that you need to cross-verify everything.

Sep 24, 2009 8:21 AM in response to Jason Swaby

Hello,

I'm in the same case.

To test "In App Purchase" functionality, I've first created a new test application signed with the provisionning profile of a paid application.
The trouble is that all products available in the "In App Purchase" are considered as invalidProducts.
I checked many times there is no misspelled errors, the checkbox "Cleared for sale" is checked and the Bundle ID provided in iTunes Connect interface is matching with the Bundle ID of the test application.
But when requesting for retrieving "In App Purchase" products informations, all available products aren't valid.
Moreover, I'm never prompted for "In App Purchase test user" login and password and there is no account in "Settings -> Store" menu logged in on the iPhone.
When displaying 'localizedDescription' of NSError class, just before the transaction fails, I have the message : "Connection to iTunes Connect is impossible".

If someone thinks to have a solution or an advice, thanks to tell me.

Oct 14, 2009 3:10 AM in response to jmikres

Hello,

I have the same problem. Anything seems to be correct, but all purchase items are returned as invalid.

I use the same source code as seen several time in this thread.
The bundle Id is correct, provioning profile is correct, product Ids (com.vendor.appname.itemname) are relative to the bundle Id (com.vendor.appname).
Also the trick from jmikres with creating the purchase items with unchecked "cleared for sale" and activating this later doesn't work.

I start to get crazy about this.
Does anyone else has an idea?

Jan 21, 2010 3:27 AM in response to supaegal

Here's something else to try.

I also have the same problem - all products being rejected as invalid - but I've found that it's caused by my application's binary being 'Developer rejected'. If I upload a new binary and leave it in review, my In App Purchases suddenly start working; reject the binary again, and the products start getting rejected again.

I spent 3 days going through my code with a fine-tooth comb before stumbling on this. I hope it helps someone.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

StoreKit - All product ID's are invalid. Why?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.