From 8687b23b8c1786e3c1aef1a9a1ed269e7163d85a Mon Sep 17 00:00:00 2001 From: zhangqinghe Date: Thu, 5 May 2016 17:49:14 +0800 Subject: [PATCH] fix #172 --- RMStore/RMStore.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/RMStore/RMStore.m b/RMStore/RMStore.m index ece43bd9..75889c72 100755 --- a/RMStore/RMStore.m +++ b/RMStore/RMStore.m @@ -215,11 +215,11 @@ - (void)addPayment:(NSString*)productIdentifier { payment.applicationUsername = userIdentifier; } - + payment.applicationUsername=[NSUUID UUID].UUIDString; RMAddPaymentParameters *parameters = [[RMAddPaymentParameters alloc] init]; parameters.successBlock = successBlock; parameters.failureBlock = failureBlock; - _addPaymentParameters[productIdentifier] = parameters; + _addPaymentParameters[payment.applicationUsername] = parameters; [[SKPaymentQueue defaultQueue] addPayment:payment]; } @@ -547,12 +547,12 @@ - (void)didFailTransaction:(SKPaymentTransaction *)transaction queue:(SKPaymentQ NSString* productIdentifier = payment.productIdentifier; RMStoreLog(@"transaction failed with product %@ and error %@", productIdentifier, error.debugDescription); - if (error.code != RMStoreErrorCodeUnableToCompleteVerification) + if (error.code == RMStoreErrorCodeUnableToCompleteVerification) { // If we were unable to complete the verification we want StoreKit to keep reminding us of the transaction [queue finishTransaction:transaction]; } - RMAddPaymentParameters *parameters = [self popAddPaymentParametersForIdentifier:productIdentifier]; + RMAddPaymentParameters *parameters = [self popAddPaymentParametersForIdentifier:payment.applicationUsername]; if (parameters.failureBlock != nil) { parameters.failureBlock(transaction, error); @@ -631,7 +631,7 @@ - (void)didDownloadSelfHostedContentForTransaction:(SKPaymentTransaction *)trans - (void)finishTransaction:(SKPaymentTransaction *)transaction queue:(SKPaymentQueue*)queue { SKPayment *payment = transaction.payment; - NSString* productIdentifier = payment.productIdentifier; + NSString* productIdentifier = payment.applicationUsername; [queue finishTransaction:transaction]; [self.transactionPersistor persistTransaction:transaction];