iOS-如果已经购买了应用本身,则可以恢复应用购买 [英] iOS - Restore in app purchase if app itself was already purchased

查看:44
本文介绍了iOS-如果已经购买了应用本身,则可以恢复应用购买的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS应用程序最初是付费应用程序,后来通过应用程序内购买选项免费提供.

An iOS app was a initially paid app, then later became free with an in app purchase option.

对于已经购买了该应用程序的用户,下面的 restore 代码是否会真正还原?还是只将应用专门还原到应用内购买?

For a user who has already purchased the app would the restore code below, actually restore it? Or does that restore only app specifically to the in app purchase?

如果仅是应用程序内购买,那么我如何确保实际为应用程序付款的用户也被还原":

If it's only to the in app purchase how can I ensure users who actually paid for the app are also 'restored':

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{

    for (SKPaymentTransaction *transaction in transactions)
    {
        switch (transaction.transactionState)
        {
            case SKPaymentTransactionStatePurchased:
                NSLog(@"Purchased Case");
                [defaultQueue finishTransaction:transaction];
                break;
            case SKPaymentTransactionStateFailed:
                NSLog(@"Failed Case");
                [defaultQueue finishTransaction:transaction];
                break;
            case SKPaymentTransactionStateRestored:
                NSLog(@"Restored Case");
                [defaultQueue restoreCompletedTransactions];
                break;                
            default:
                break;
        }
    }

}

我使用以下方法获取应用程序内购买产品本身:

And I get the in-app purchased product itself using:

- (void) getProductInfo
{
    if ([SKPaymentQueue canMakePayments])
    {
        NSSet *productID = [NSSet setWithObject:@"myoneoffid"];
        SKProductsRequest *request = [[SKProductsRequest alloc]initWithProductIdentifiers:productID];
        request.delegate = self;
        [request start];
    }
}

谢谢.

推荐答案

否,您不能使用还原购买"功能向最初在添加应用内购买之前购买非免费应用的用户授予访问权限.当然,对于确实购买了应用程序内购买的新用户,您需要在更新的应用程序中具有该功能.

No, you can't use the "restore purchases" functionality to grant access to users who originally purchased your non-free app prior to adding in-app purchases. Of course you need that functionality in your updated app for newer users that do purchase the in-app purchases.

要处理应用的早期购买者,您需要进行收据验证.您可以获取收据并检查原始购买版本.如果该版本比您通过应用内购买转换为免费版本的版本要旧,那么您可以授予用户访问这些功能的权限,而无需支付任何费用.

To handle the case of earlier purchasers of your app, you need to do receipt validation. You can get the receipt and check the original purchase version. If that version is older than whatever version you switched to free with in-app purchases, then you can grant the user access to those features without making them pay for anything.

请参见将付费应用更改为免费,但知道用户以前是否购买过以获取更多详细信息.

See Change paid app to free but know if user previously purchased it for more details.

这篇关于iOS-如果已经购买了应用本身,则可以恢复应用购买的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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