我使用下面的代码来检索产品列表
-(void) viewWillAppear:(BOOL)animated
{
if ([SKPaymentQueue canMakePayments]) {
NSLog(@"Parental-controls are disabled");
//Request products.Retrieving list of products
SKProductsRequest *productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:@"com.test.SinFinder"]];
productsRequest.delegate = self;
[productsRequest start];
} else {
NSLog(@"Parental-controls are enabled");
}
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
SKProduct *validProduct = nil;
int count = [response.products count];
NSLog(@"count : %d",count);
if (count > 0) {
validProduct = [response.products objectAtIndex:0];
} else if (!validProduct) {
NSLog(@"No products available");
}
}
在处理响应时,我计算为零,因此在updatedTransactions
方法中,它会转到SKPaymentTransactionStateFailed
并记录错误。
我不知道出了什么问题或者缺少什么
或者这是必要的,即产品列表,因为我只需要在购买应用后锁定功能
答案 0 :(得分:1)
尝试在gdb上打印产品,如果您发现产品无效,refer this link in that case.
refer this for a complete look of developing in app into our application
TNQ