【问题标题】:IOS - Restoring in-app purchaseIOS - 恢复应用内购买
【发布时间】:2012-08-08 02:27:43
【问题描述】:

应用内购买的新手。我正在添加一个按钮,允许用户恢复以前购买的产品。当我使用这个时,首先提示用户购买=>输入登录信息->说已经购买->下载产品。我不希望用户确认购买,即使他们没有为同一产品收费。我已经阅读了有关使用 restoreCompletedTransactions 的信息,有人可以帮我解决我需要用什么来替换下面的代码 sn-p。非常感谢!

- (IBAction) OnAlreadyBtnClick:(id)sender
{
     /* code to get the in-app product id*/
     SKPayment *payment = [SKPayment paymentWithProductIdentifier:strIAP_Name];
     [[SKPaymentQueue defaultQueue] addPayment:payment];
     /* code to download the product */
}

【问题讨论】:

    标签: ios in-app


    【解决方案1】:

    只需用这两行替换您的代码

    [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
    [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
    

    【讨论】:

      【解决方案2】:

      首先调用这个方法

      - (void)restoreCompletedTransactions;
      
      - (void)restoreCompletedTransactions {
      [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
       }
      
       - (IBAction) OnAlreadyBtnClick:(id)sender
       {
       [[RageIAPHelper sharedInstance] restoreCompletedTransactions];
       }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-27
        • 2012-06-21
        • 1970-01-01
        • 2013-03-17
        相关资源
        最近更新 更多