我在 InAppPurchase 付款过程中SKPayment *pay=[SKPayment paymentWithProductIdentifier:myProduct];
使用以下内容,Appstore 是否拒绝我的应用程序。我使用以下代码进行 paymentWithProductIdentifier。如何为此代码使用 paymentWithProduct
代码:
在 .h 文件中
#define PRODUCT_IDENTIFIER @"com.company.appname.product"
在 .m 文件中
SKRequest *request=[[SKRequest alloc]init];
request.delegate=self;
[request start];
SKProductsRequest *productRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:PRODUCT_IDENTIFIER]];
productRequest.delegate = self;
[productRequest start];
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
SKProduct *product;
NSArray *myProduct = response.products;
NSArray *myProduct1 = response.invalidProductIdentifiers;
printf("\n inside didReceiveResponse ....myProduct count----%d\t",[myProduct count]);
printf("\n inside didReceiveResponse ....INVALID Products count----%d\t",[myProduct1 count]);
if([myProduct count] >0){
for(int i=0;i<[myProduct count];i++)
{
product = [myProduct objectAtIndex:i];
}
[request release];
[self performSelector:@selector(preCheckForPayment) withObject:self afterDelay:0.1];
}
}
-(void)checkForPayments{
if ([SKPaymentQueue canMakePayments])
{
printf("\n YES u can make payments");
SKPayment *myPayment = [SKPayment paymentWithProductIdentifier:PRODUCT_IDENTIFIER];
[[SKPaymentQueue defaultQueue] addPayment:myPayment];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
}
}