Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 应用内购买-仅恢复一个产品_Ios - Fatal编程技术网

Ios 应用内购买-仅恢复一个产品

Ios 应用内购买-仅恢复一个产品,ios,Ios,我目前正在为我的应用程序实施恢复功能。我有几个应用内购买的产品是非消耗品,我想让用户只恢复一两个,这样我就不会下载超过需要的内容。在its声明中,我可以这样做: NSMutableArray *productIDsToRestore = <# From the user #>; SKPaymentTransaction *transaction = <# Current transaction #>; if ([productIDsToRestore containsO

我目前正在为我的应用程序实施恢复功能。我有几个应用内购买的产品是非消耗品,我想让用户只恢复一两个,这样我就不会下载超过需要的内容。在its声明中,我可以这样做:

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];
}
但是,根据我的经验,产品ID与事务标识符不匹配。根据产品ID,我理解用于从应用商店检索产品的字符串,例如com.mydomain.myproduct。事务标识符似乎是一个很长的数字,即使它是作为字符串接收的

我遗漏了什么以及如何实现这一点


谢谢

请尝试此操作-voidpaymentQueueRestoreCompletedTransactionsFinished:SKPaymentQueue*队列{用于队列中的SKPaymentTransaction*事务{NSString*productID=transaction.payment.productIdentifier;如果[productID IsequalString:@YourProductID]{//Show confirm messagebox[alert Show];}}}}}这很有效,感谢您的快速回复!如果可以,请将回答标记为已接受