概述
出现这样的问题,是支付没有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;
}
}
最后
以上就是怕孤独黑夜为你收集整理的[绍棠] This In-App purchase has already been bought. It will be restored for free.的全部内容,希望文章能够帮你解决[绍棠] This In-App purchase has already been bought. It will be restored for free.所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复