私はInAppPurchase 支払いプロセスに以下を使用しています.Is SKPayment *pay=[SKPayment paymentWithProductIdentifier:myProduct];
appstore reject my app or not.. 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];
}
}