Apple因拒绝购买而未实施还原 [英] Apple reject because of In app purchase not implement restore

查看:132
本文介绍了Apple因拒绝购买而未实施还原的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被Apple拒绝了一条消息说:

I got rejected by Apple with a message saying:


...此外,我们发现当你的应用提供In-App时购买可以恢复的
,它不包括所需的恢复
功能,以允许用户恢复以前购买的应用内
购买,如
应用程序内购买编程指南的恢复事务部分:

... Additionally, we found that while your app offers In-App Purchase(s) that can be restored, it does not include the required "Restore" feature to allow users to restore the previously purchased In-App Purchase(s), as specified in Restoring Transactions section of the In-App Purchase Programming Guide:

...如果您的应用程序支持必须为
可恢复的产品类型,你必须包含一个界面,允许用户恢复这些购买
。这个界面允许用户将产品添加到
其他设备,或者,如果原始设备被擦除,恢复
交易在原始设备上。

"...if your application supports product types that must be restorable, you must include an interface that allows users to restore these purchases. This interface allows a user to add the product to other devices or, if the original device was wiped, to restore the transaction on the original device."

要恢复以前购买的应用程序内购买产品,提供恢复按钮并启动恢复将是
当你点击恢复按钮时
进程ser。

To restore previously purchased In-App Purchase products, it would be appropriate to provide a "Restore" button and initiate the restore process when the "Restore" button is tapped by the user.

有关恢复交易和验证商店
收据的更多信息,请参阅应用程序内购买编程指南。
...

For more information about restoring transactions and verifying store receipt, please refer to the In-App Purchase Programming Guide. ...

我发现这个页面,我按照示例代码,但在我打电话后

And I found this page, and I followed the sample code , but after I called

- (void) checkPurchasedItems{
   [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
}

另一名代表未被解雇!

- (void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue

它只会弹出一个警报视图,让你输入你的Apple ID ......什么都没发生?

It only popups an alert view, to let you enter your Apple ID ... and nothing happened?

我设置了一个断点,但它不会'如示例所示,停止。

I set a break point, but it wouldn't stop as the example said.

关于我的代码有什么问题的任何想法?

Any ideas on what's wrong with my code?

推荐答案

除了添加 restoreCompletedTransactions 之外,您还需要处理iaps实际恢复到用户的方式以及如何向用户提供内容。

In addition to adding restoreCompletedTransactions, you need to handle how your iaps are actually restored to the user and how the content is provided to the user.

基本上,您需要回忆一下您最初购买时为用户提供商品的方式。

Basically, you need to recall the way you provide the item to your user when they originally purchased it.

对于示例,th是我如何在我的一个应用程序中恢复产品。

For example, this is how I restore products in one of my apps.

- (void)restoreTransaction:(SKPaymentTransaction *)transaction
{
    isRestoring = YES;

    [self recordTransaction: transaction];

    /* This is where I provide the content to the user: */
    [self provideContent: transaction.originalTransaction.payment.productIdentifier];

    [[SKPaymentQueue defaultQueue] finishTransaction: transaction];
}



交易已完成



Transaction Completed

- (void)completeTransaction:(SKPaymentTransaction *)transaction
{
    [self recordTransaction: transaction];
    [self provideContent: transaction.payment.productIdentifier];
    [[SKPaymentQueue defaultQueue] finishTransaction: transaction];
}



付款队列



Payment Queue

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
    for (SKPaymentTransaction *transaction in transactions)
    {
        switch (transaction.transactionState)
        {
            case SKPaymentTransactionStatePurchased:
                [self completeTransaction:transaction];
                break;
            case SKPaymentTransactionStateFailed:
                if (transaction.error.code == SKErrorPaymentCancelled) {
                    /// user has cancelled
                    [[NSNotificationCenter defaultCenter] postNotificationName:@"hideRestoring" object:nil];
                }
                [self failedTransaction:transaction];
                break;
            case SKPaymentTransactionStateRestored:
                [self restoreTransaction:transaction];
            default:
                break;
        }
    }
}



提供内容



Provide the Content

- (void)provideContent:(NSString *)productIdentifier
{
    int index;

    NSMutableDictionary * purchased = [NSMutableDictionary dictionaryWithContentsOfFile:EXTRAS_PATH];

    NSArray * availableProducts = [NSArray arrayWithContentsOfURL:[NSURL URLWithString:SCANNER_IN_APP_PURCHASES]];

    if ( isRestoring )
    {
        for ( index = 0; index < [availableProducts count]; index++ )
        {
            //NSLog(@"productIdentifier: %@",productIdentifier);
            //NSLog(@"Product: %@",[availableProducts objectAtIndex:index]);

            if ( [productIdentifier isEqualToString:[[availableProducts objectAtIndex:index] objectForKey:@"BundleID"]] )
            {
                [purchased setObject:[availableProducts objectAtIndex:index] forKey:productIdentifier];

                [purchased writeToFile:EXTRAS_PATH atomically:YES];

                [_purchasedProducts addObject:productIdentifier];
            }
        }
    }
    else
    {
        index = [[[NSUserDefaults standardUserDefaults] objectForKey:@"kTempProductPurchasingIndex"] intValue];

        if ( [productIdentifier isEqualToString:[[availableProducts objectAtIndex:index] objectForKey:@"BundleID"]] )
        {
            [purchased setObject:[availableProducts objectAtIndex:index] forKey:productIdentifier];

            [purchased writeToFile:EXTRAS_PATH atomically:YES];

            [_purchasedProducts addObject:productIdentifier];
        }
    }

    [[NSNotificationCenter defaultCenter] postNotificationName:kProductPurchasedNotification object:productIdentifier];
}

这篇关于Apple因拒绝购买而未实施还原的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆