Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In-App Purchase response.products empty

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
like image 861
tiw Avatar asked Jul 11 '11 17:07

tiw


People also ask

Why are my in-app purchases not working?

If you haven't received an in-app item you bought, try closing and restarting the app or game you're using. Tap Apps or Manage applications (depending on your device, this may be different). Tap the app you used to make your in-app purchase.

How do you fix no in-app purchases on iPhone?

You can check if the in-app purchases are enabled on your device by opening your device's settings by following these steps: Open the Settings app on your iPhone or iPad. Go to Screen Time Screen Time> Content & Privacy Restrictions > iTunes & App Store Purchases > In-app Purchases. Select "Allow"

What does it mean when it says no in-app purchases?

If you get hit with a message on your Apple iPhone or iPad that says “Purchase – In-app purchases are not allowed” when trying to buy purchases from within apps, it may be related to a restriction setting on the device. From the Home screen, swipe over to the screen with the “Settings” icon, then select it.


1 Answers

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.
like image 189
malinois Avatar answered Nov 15 '22 13:11

malinois