刚开始使用商店套件框架。我有两个问题:
1)有没有办法找出当前用户购买的所有商品? (获取ID列表) 2)有没有办法购买所有物品?或者我是否必须提示每个用户?
由于
答案 0 :(得分:1)
有一种方法可以通过调用[[SKPaymentQueue defaultQueue] restoreCompletedTransactions]查找购买的商品;
然后
-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{
for (SKPaymentTransaction * transaction in transactions) {
switch (transaction.transactionState)
{
case SKPaymentTransactionStatePurchased: break;
case SKPaymentTransactionStateRestored:
//从transaction.originalTransaction.payment.productIdentifier获取有关项目的信息
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
case SKPaymentTransactionStateFailed: break;
case SKPaymentTransactionStatePurchasing: break;
default:
break;
}
}
}
2)即使您可以告诉用户只需点击一下即可购买所有商品。将要求用户单独购买每件商品。
答案 1 :(得分:0)
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];