1

我有一个正在审核的应用程序被拒绝,动机说:

2.2 应用仍未正确使用 Store Kit API。它没有从 App Store 的服务器获取定价信息(见屏幕截图)。使用 Store Kit,应用程序应该向 App Store 发送请求,以检索当前可供购买的产品标识符列表。一旦应用程序收到此列表,它应该只显示那些标记为可供购买的产品。应用程序不会向 App Store 发出此请求,而是显示服务器直接返回的产品。

这是截图

在此处输入图像描述

我真的不明白我需要做什么......对我来说,一切正常,我也不明白为什么他们说“产品直接由我的服务器返回”......这不像那....我将向您展示我的代码:

-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
    if(response.products.count > 0)
{
    SKProduct* product;

    for(int i = 0; i<response.products.count; i++)
    {
        product = [response.products objectAtIndex:i];

        if([product.productIdentifier isEqualToString:@"com.mySite.MyApp.1"] || [product.productIdentifier isEqualToString:@"com.mySite.MyApp.2"] || [product.productIdentifier isEqualToString:@"com.mySite.MyApp.3"] || [product.productIdentifier isEqualToString:@"com.mySite.MyApp.4"] || [product.productIdentifier isEqualToString:@"com.mySite.MyApp.5"])
        {
            self.currentProduct = product;
            [self beginPaymentWithProduct:product];
        }
    }
  }
 }


- (void)beginPaymentWithProduct:(SKProduct*)product
{
    SKPayment *payment = [SKPayment paymentWithProduct:product];
    [[SKPaymentQueue defaultQueue] addPayment:payment];
}


- (BOOL)canMakePurchases
{
    return [SKPaymentQueue canMakePayments];
}


- (IBAction)buyProduct1:(id)sender
{
   if([self canMakePurchases])
   {
     self.prodottoScelto = @"1";
    [moneteAcquistateLabel setStringValue:@"25"];
    ualRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet   setWithArray:[NSArray arrayWithObjects: @"com.mySite.MyApp.1", nil]]];
    [ualRequest setDelegate:self];
    [ualRequest start];
    }

}


 - (IBAction)buyProduct2:(id)sender
  {
    //same code as below
  }


  - (IBAction)buyProduct3:(id)sender
     {
      //same code as below
     }


   - (IBAction)buyProduct4:(id)sender
     {
      //same code as below
     }


    - (IBAction)buyProduct5:(id)sender
    {
      //same code as below
     }



      - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
        {
          for (SKPaymentTransaction* transaction in transactions) {
           if (transaction.transactionState == SKPaymentTransactionStatePurchased) {


            //    NSLog(@"Transaction Purchased: %@", transaction);

            // Make purchase available to the user, etc...

           //assegno le monete acquistate all'utente
            if ([prodottoScelto isEqual:@"1"])
              {                
            //  NSLog(@"prodotto 1 sbloccato");
            [self aggiornaMonete:25];
        }
        else if ([prodottoScelto isEqual:@"2"])
        {
            //  NSLog(@"prodotto 2 sbloccato");
            [self aggiornaMonete:60];
        }
        else if ([prodottoScelto isEqual:@"3"])
        {
            //  NSLog(@"prodotto 3 sbloccato");
            [self aggiornaMonete:105];
        }
        else if ([prodottoScelto isEqual:@"4"])
        {
            //  NSLog(@"prodotto 4 sbloccato");
            [self aggiornaMonete:160];
        }
        else if ([prodottoScelto isEqual:@"5"])
        {
            //  NSLog(@"prodotto 5 sbloccato");
            [self aggiornaMonete:225];
        }

        // Once that's all done...
        [queue finishTransaction:transaction];


    }
    else if (transaction.transactionState == SKPaymentTransactionStateFailed) {

        //NSLog(@"Transaction Failed: %@", transaction);
        // Display error to the user, using the error text in the transaction
        // This example uses NSLog, typically you'd use UIAlertView here
        //  NSLog(@"Error: %@", [transaction.error localizedDescription]);
    }
   }
  }

我应该添加什么?同样的代码在iOS应用程序中运行良好......感谢您的帮助

4

1 回答 1

1

审阅者可能假设您正在从服务器检索产品列表,但实际上您的产品实际上是硬编码到您的应用程序中的。显然他只是猜到了。

无论如何,您应该从应用商店中检索产品列表并在您的应用中显示商店中的价格值。我想这只是为了确保您在 itunesconnect 中创建的产品与您在应用程序中提供的产品之间没有不一致。这个“内置产品模型”有一个很好的序列图:In-App Purchase Programming Guide

所以我会用它productsRequest:didReceiveResponse:来更新或创建显示待售物品的视图:

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {

    NSArray *skProducts = response.products;
    for (SKProduct *skProduct in skProducts) {
        NSLog(@"Found product: %@ %@ %0.2f",
              skProduct.productIdentifier,
              skProduct.localizedTitle,
              skProduct.price.floatValue);
    }
}

但在此之前,您必须告诉应用商店您期望的产品是什么(内置产品模型):

productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObjects:@"com.makemyday.appy.product", nil]];
productsRequest.delegate = someObjectProbablySelf;
[productsRequest start];

现在有人可以从商店购买带有价格和标题的产品:

- (void)buyProduct:(SKProduct *)product {
    SKPayment *payment = [SKPayment paymentWithProduct:product];
    [[SKPaymentQueue defaultQueue] addPayment:payment];    
}

此外,您应该分配一些对象来观察事务队列以监视完成或失败的事务,一个实现SKPaymentTransactionObserver协议的对象:

[[SKPaymentQueue defaultQueue] addTransactionObserver:someObjectProbablySelf];

这些只是我从本教程中收集的最重要的片段(对于 iOS,但对于 OSX 也应该没问题)。

为什么它适用于 iOS?可能是您的 iOS 应用程序的审阅者没有注意到。

于 2013-06-25T09:21:08.473 回答