在版主审核我的应用时,应用购买无法正常工作

时间:2014-10-04 13:06:18

标签: ios objective-c xcode in-app-purchase appstore-approval

我第一次在IAP上工作。我已经创建了测试用户并且在沙盒环境中工作得很好。我可以看到我的购买并购买它(当然我添加了StoreKit框架。)但问题是:当我将更新与IAP上传到AppStore时 - 主持人拒绝我的应用程序,这是一个原因:

我们发现,当您为应用程序提交In App Purchase产品时,二进制文件中不存在In App Purchase功能。有关详细信息,请参阅随附的屏幕截图。(屏幕上没有一些购买,而是空白空间)

如果您希望在应用中使用In App Purchase,则需要上传包含In App Purchase API的新二进制文件,以便用户进行购买

我只是不明白它是如何可能的?为什么当我测试IAP时 - 它的工作正常,但是当主持人这样做时它不起作用?所有IAP都有"清除待售"和#34;等待审核"状态

现在,如果我将应用程序上传到商店,IAP是否有效?或者我可能需要先做一些额外的动作?

这是我的代码:

- (void)viewDidLoad
{
    [super viewDidLoad];
    _iapArray = [[NSMutableArray alloc] init];
    iap1 = @"com.mypurchase.addcoins1";

    [self paymentCheck];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [[SKPaymentQueue defaultQueue] removeTransactionObserver:self];
}

- (void)paymentCheck{

    if([SKPaymentQueue canMakePayments]){
        NSLog(@"User can make payments");

        SKProductsRequest *productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObjects:iap1, nil]];
        productsRequest.delegate = self;
        [productsRequest start];

    }
    else{
        NSLog(@"User cannot make payments due to parental controls");
        //this is called the user cannot make payments, most likely due to parental controls
    }
}

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
    SKProduct *validProduct = nil;
    int count = [response.products count];
    if(count > 0){

        _iapArray = response.products;
        indicator.hidden = YES;
        [self.tableView reloadData];
    }
    else if(!validProduct){
        NSLog(@"No products available");

        UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Error"
                                                              message:@"Error"
                                                             delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
        [myAlertView show];
        //this is called if your product id is not valid, this shouldn't be called unless that happens.
    }
}


- (IBAction)purchase:(SKProduct *)product{
    SKPayment *payment = [SKPayment paymentWithProduct:product];
    [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
    [[SKPaymentQueue defaultQueue] addPayment:payment];
}

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{
    for(SKPaymentTransaction *transaction in transactions){
        switch (transaction.transactionState){
            case SKPaymentTransactionStatePurchasing: NSLog(@"Transaction state -> Purchasing");
                //called when the user is in the process of purchasing, do not add any of your own code here.
                break;
            case SKPaymentTransactionStatePurchased:
                //this is called when the user has successfully purchased the package (Cha-Ching!)
                // [self doRemoveAds]; //you can add your code for what you want to happen when the user buys the purchase here, for this tutorial we use removing ads
                [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
                NSLog(@"Transaction state -> Purchased - %@", transaction.payment.productIdentifier);

                if ([transaction.payment.productIdentifier isEqualToString:iap1]) {
                    [self addCoins:5];
                }

                break;
            case SKPaymentTransactionStateRestored:
                NSLog(@"Transaction state -> Restored");
                //add the same code as you did from SKPaymentTransactionStatePurchased here
                [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
                break;
            case SKPaymentTransactionStateFailed:
                //called when the transaction does not finnish
                if(transaction.error.code != SKErrorPaymentCancelled){
                    NSLog(@"Transaction state -> Cancelled");
                    //the user cancelled the payment ;(
                }
                [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
                break;
        }
    }
}

1 个答案:

答案 0 :(得分:0)

根据他们的回复,您已将IAP集成到应用程序中但尚未使用它。那么,您能否确保在应用程序中正确集成了IAP?如果他们提到,请在相同的设备和iOS中进行测试。