出现这样的问题,是支付没有finish造成的,一般在支付过程中断网了,下次再购买同一商品的时候就会出现这样的问题,
解决办法,在点击购买的时候判断支付队列中是否有为finish的商品,若有,则进行处理之后将其finish
NSArray* transactions = [SKPaymentQueue defaultQueue].transactions;
if (transactions.count > 0) {
//检测是否有未完成的交易
SKPaymentTransaction* transaction = [transactions firstObject];
if (transaction.transactionState == SKPaymentTransactionStatePurchased) {
[self completeTransaction:transaction];
return;
} else if (transaction.transactionState == SKPaymentTransactionStateFailed){
[self finishTransaction:transaction wasSuccessful:NO];
return;
}
}