我正在使用以下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];
}
}
答案 0 :(得分:0)
答案 1 :(得分:0)
不,他们不会拒绝您的应用,但您应该将paymentWithProductIdentifier
更改为paymentWithProduct:
方法。
答案 2 :(得分:0)
是的,使用+ paymentWithProduct:。
+ (id)paymentWithProduct:(SKProduct *)product
答案 3 :(得分:0)
使用已弃用的API不太可能会被拒绝(uniqueIdentifier
方法是一个值得注意的例外,但这是另一个故事)。另一方面,为什么不能使用paymentWithProduct:
呢?