アプリのアプリ内購入を実装しました。正常に動作していましたが、 の後に応答が得られなくなりましたSKProductsRequest
。
私のコードを添付する
[self.delegate showProgressHUDWithTitle:@"Loading Product"];
// select from IPA Items //
// Check if Parental Control is enabled so that purchase will fail //
if ([SKPaymentQueue canMakePayments])
{
SKProductsRequest *Prequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:@"Item 1"]];
Prequest.delegate = self;
[Prequest start];
request = Prequest;
}
このメソッドも呼び出されていません ---> -(void)request:(SKRequest *)request didFailWithError:(NSError *) error
-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
[self.delegate hideProgressHUD];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
SKProduct *validProduct = nil;
int count = [response.products count];
if (count>0)
{
validProduct = [response.products objectAtIndex:0];
if ([validProduct.productIdentifier isEqualToString:purchasingItem])
{
SKPayment *payment = [SKPayment paymentWithProduct:validProduct];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
else
{
NSLog(@"No Valid Products");
}
}
}