如何根据Apple ID检查已购买或未使用iOS中的应用程序内购买的用户

时间:2023-01-12 21:48:14

I want to know how to check if already purchased or not based on apple id as I don’t have login in my app.

我想知道如何根据苹果ID检查是否已购买,因为我没有在我的应用程序中登录。

Below is my code:

以下是我的代码:

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

Any help how to proceed?

有什么帮助怎么办?

2 个解决方案

#1


2  

Your app starts the process by calling the

您的应用程序通过调用来启动该过程

restoreCompletedTransactions method of SKPaymentQueue class

SKPaymentQueue类的restoreCompletedTransactions方法

This sends a request to the App Store to restore all of your app’s completed transactions. If your app sets a value for the applicationUsername property of its payment requests, as described in Detecting Irregular Activity, use the

这会向App Store发送请求,以恢复所有应用已完成的交易。如果您的应用为其付款请求的applicationUsername属性设置了值,请参阅检测不规则活动中所述,请使用

restoreCompletedTransactionsWithApplicationUsername:

restoreCompletedTransactionsWithApplicationUsername:

method to provide the same information when restoring transactions.

恢复事务时提供相同信息的方法。

Your transaction queue observer is called with a status of SKPaymentTransactionStateRestored for each restored transaction, as described in Waiting for the App Store to Process Transactions. The action you take at this point depends on the design of your app.

对于每个还原的事务,将调用状态为SKPaymentTransactionStateRestored的事务队列观察器,如等待App Store处理事务中所述。您此时采取的操作取决于您的应用程序的设计。

NSMutableArray *productIDsToRestore = <# From the user #>;
SKPaymentTransaction *transaction = <# Current transaction #>;

if ([productIDsToRestore containsObject:transaction.transactionIdentifier]) {
    // Re-download the Apple-hosted content, then finish the transaction
    // and remove the product identifier from the array of product IDs.
} else {
    [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}

Read the Apple Documentation here.

在此处阅读Apple文档。

#2


0  

You can get a list of previous transactions from the store with -[SKPaymentQueue restoreCompletedTransactions]. The restored transactions can be verified just like normal transactions.

您可以使用 - [SKPaymentQueue restoreCompletedTransactions]从商店获取以前的交易列表。恢复的事务可以像正常事务一样进行验证。

#1


2  

Your app starts the process by calling the

您的应用程序通过调用来启动该过程

restoreCompletedTransactions method of SKPaymentQueue class

SKPaymentQueue类的restoreCompletedTransactions方法

This sends a request to the App Store to restore all of your app’s completed transactions. If your app sets a value for the applicationUsername property of its payment requests, as described in Detecting Irregular Activity, use the

这会向App Store发送请求,以恢复所有应用已完成的交易。如果您的应用为其付款请求的applicationUsername属性设置了值,请参阅检测不规则活动中所述,请使用

restoreCompletedTransactionsWithApplicationUsername:

restoreCompletedTransactionsWithApplicationUsername:

method to provide the same information when restoring transactions.

恢复事务时提供相同信息的方法。

Your transaction queue observer is called with a status of SKPaymentTransactionStateRestored for each restored transaction, as described in Waiting for the App Store to Process Transactions. The action you take at this point depends on the design of your app.

对于每个还原的事务,将调用状态为SKPaymentTransactionStateRestored的事务队列观察器,如等待App Store处理事务中所述。您此时采取的操作取决于您的应用程序的设计。

NSMutableArray *productIDsToRestore = <# From the user #>;
SKPaymentTransaction *transaction = <# Current transaction #>;

if ([productIDsToRestore containsObject:transaction.transactionIdentifier]) {
    // Re-download the Apple-hosted content, then finish the transaction
    // and remove the product identifier from the array of product IDs.
} else {
    [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}

Read the Apple Documentation here.

在此处阅读Apple文档。

#2


0  

You can get a list of previous transactions from the store with -[SKPaymentQueue restoreCompletedTransactions]. The restored transactions can be verified just like normal transactions.

您可以使用 - [SKPaymentQueue restoreCompletedTransactions]从商店获取以前的交易列表。恢复的事务可以像正常事务一样进行验证。