iap: invalid product id
I'm testing the in-app purchase mechanism in my app. I signed out of my Apple ID in Settings. For some reason, when I attempt to make the purchase, StoreKit doesn't request my username and password and hence the product id always comes back as invalid. I've created a test user and the in-app purchases are approved in iTunes Connect.
Here is the relevant code to make the purchase:
- (void)requestProUpgradeProductData
{
NSSet *productIdentifiers = [NSSet setWithObject:kInAppPurchaseProUpgradeProductId];
productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
productsRequest.delegate = self;
[productsRequest start];
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSArray *products = response.products;
proUpgradeProduct = [products count] == 1 ? [products firstObject] : nil;
if(proUpgradeProduct) {
NSLog(@"Product title: %@" , proUpgradeProduct.localizedTitle);
NSLog(@"Product description: %@" , proUpgradeProduct.localizedDescription);
NSLog(@"Product price: %@" , proUpgradeProduct.price);
NSLog(@"Product id: %@" , proUpgradeProduct.productIdentifier);
}
for (NSString *invalidProductId in response.invalidProductIdentifiers)
NSLog(@"Invalid product id: %@" , invalidProductId);
[[NSNotificationCenter defaultCenter] postNotificationName:kInAppPurchaseManagerProductsFetchedNotification object:self userInfo:nil];
SKMutablePayment *myPayment = [SKMutablePayment paymentWithProduct:proUpgradeProduct];
[[SKPaymentQueue defaultQueue] addPayment:myPayment];
}
- (void)loadStore
{
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[self requestProUpgradeProductData];
}
- (BOOL)canMakePurchases
{
return [SKPaymentQueue canMakePayments];
}
Why is the login dialog not displaying when I attempt to make the purchase?
Thanks,
Mike
iPhone 5, iOS 7.0.4