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