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];
}
以上参考代码来自StoreKit指南,恢复已完成的交易章节。我在这里能够理解为什么productIDsToRestore
搜索交易ID?里面的东西是什么?如果它的对象用事务ID键入,那么正如Apple在章节前面所述,事务ID每次都是唯一的。只有原始交易ID才会相同。