Browse Source

add entitlement revocation only once

Stefanos Zachariadis 5 years ago
parent
commit
3e7d70d9bd
1 changed files with 5 additions and 0 deletions
  1. 5 0
      Sources/SwiftyStoreKit/PaymentQueueController.swift

+ 5 - 0
Sources/SwiftyStoreKit/PaymentQueueController.swift

@@ -248,6 +248,11 @@ class PaymentQueueController: NSObject, SKPaymentTransactionObserver {
     }
     
     func paymentQueue(_ queue: SKPaymentQueue, didRevokeEntitlementsForProductIdentifiers productIdentifiers: [String]) {
+        guard entitlementRevocation == nil else {
+            print("SwiftyStoreKit.onEntitlementRevocation() should only be called once when the app launches. Ignoring this call")
+            return
+        }
+
         self.entitlementRevocation?.callback(productIdentifiers)
     }