我已经为我的应用实施了应用内购买。它工作正常,但现在我无法在之后得到回复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");
}
}
}