5

I know it has been asked before: iPhone In App Purchase - response.products are still empty?

but I am also trying to implement an in app purchase and my response.products is empty. My situation:

I uploaded and rejected my binary once.

But then I put the status back to waiting for upload again.(Does it matter?)

The status of all my in app purchase products are "Ready to Submit".

My production user is signed out. Test user not signed in yet.

-(void) requestProductData{
    SKProductsRequest *productRequest= [[SKProductsRequest alloc] 
                                 initWithProductIdentifiers:[NSSet setWithObjects:
                                                             @"com.mydomain.myapp.Pack1", 
                                                             @"com.mydomain.myapp.Pack2",
                                                             @"com.mydomain.myapp.Pack3",nil]];

productRequest.delegate = self;
[productRequest start];
}

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

NSArray *myProducts = response.products; 

NSLog(@"%d",[myProducts count]);//this prints 0
for(SKProduct * product in myProducts) {
    [products addObject:product];
}
[request autorelease]; 


}

    in my viewdidload:


if([SKPaymentQueue canMakePayments]) {
        NSLog(@"IN-APP:can make payments");
    }
    else {
        NSLog(@"IN-APP:can't make payments");
    }

    /*load transaction history to see if the user already bought some packs*/
    [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
    products = [[NSMutableArray alloc] init];
    NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0]; 
    NSString * path = [documentsDirectory stringByAppendingPathComponent: @"history.plist"];
    self.transactionHistory = [NSMutableArray arrayWithContentsOfFile: path];

    if(!transactionHistory) { 
        NSMutableArray *_transactionHistory = [[NSMutableArray alloc] init]; 
        self.transactionHistory = _transactionHistory;
        [_transactionHistory release];
    } 
    //some other initializations here
    [self requestProductData];

for (NSString *invalidProductId in response.invalidProductIdentifiers)
    {
        NSLog(@"Invalid product id: %@" , invalidProductId);
    }
//this returns 3 of my product id's
Community
  • 1
  • 1
tiw
  • 535
  • 1
  • 6
  • 22
  • Empty or the response is "Invalid Product IDs" ? – Michaël Jul 11 '11 at 18:03
  • in the debugger if i look at response. there is NSObject - isa and _internal - isa but that's it. i don't even see response.products in the debugger and when i say NSArray *myProducts = response.products; myProducts has 0 elements – tiw Jul 11 '11 at 18:09
  • yes :] is it not possible to debug storekit? – tiw Jul 11 '11 at 18:13
  • 1
    What is the value of invalidProductIdentifiers property ? – Michaël Jul 11 '11 at 18:24
  • yup you are right i have that array full of my product ids. what should i do? – tiw Jul 11 '11 at 18:35
  • Worked for me, but YMMV. Be sure you have signed all the financial information in iTunesConnect. Went from this exact problem, to working almost instantly. – Daniel Blezek Jul 11 '11 at 18:50
  • I already have a payed app in the store. So it seems like I have signed them all.. – tiw Jul 11 '11 at 18:52

1 Answers1

12

You have an invalid product error, so check your configuration with this topic: Invalid Product IDs

  • Have you enabled In-App Purchases for your App ID?
  • Have you checked Cleared for Sale for your product?
  • Have you submitted (and optionally rejected) your application binary?
  • Does your project’s .plist Bundle ID match your App ID?
  • Have you generated and installed a new provisioning profile for the new App ID?
  • Have you configured your project to code sign using this new provisioning profile?
  • Are you building for iPhone OS 3.0 or above?
  • Are you using the full product ID when when making an SKProductRequest?
  • Have you waited several hours since adding your product to iTunes Connect?
  • Are your bank details active on iTunes Connect?
  • Have you tried deleting the app from your device and reinstalling?
  • Is your device jailbroken? If so, you need to revert the jailbreak for IAP to work.
Daniel Storm
  • 18,301
  • 9
  • 84
  • 152
Michaël
  • 6,676
  • 3
  • 36
  • 55
  • do i have to submit my products for review for them to become valid? – tiw Jul 11 '11 at 19:01
  • Yes I have read it. If you are referring to this question on that page: "Have you waited several hours since adding your product to iTunes Connect?" My question is still valid. Does "adding your product to ITunes Connect mean it's status is "ready to submit" or "ready for sale"? – tiw Jul 11 '11 at 21:22
  • No, for testing, you product is not submited yet, when your tests are good, add a screenshot and submit. In your case, it's before that, so you do not have "ready to submit" or "ready for sale". – Michaël Jul 11 '11 at 21:32