SwiftyStoreKit icon indicating copy to clipboard operation
SwiftyStoreKit copied to clipboard

Non Consumable restoration not working.

Open sourov2008 opened this issue 3 years ago • 0 comments

Bug Report

I am trying to restore my Non-Consumable product. But It's showing not purchased when debugging.

Xcode 12.5 iOS 14 SwiftyStoreKit - 0.16.1

    func verifySubscriptionNonConsumeable(product : RegisteredPurchase, isSilent : Bool = false)  {
        let appleValidator = AppleReceiptValidator(service: .production, sharedSecret: sharedSecret)
        SwiftyStoreKit.verifyReceipt(using: appleValidator) { result in
            
            switch result {
            case .success(let receipt):
                let productId = product.rawValue
                // Verify the purchase of a Subscription
                let purchaseResult = SwiftyStoreKit.verifySubscription(
                    ofType: .nonRenewing(validDuration: 3742374737), // or .nonRenewing (see below)
                    productId: productId,
                    inReceipt: receipt)
                    
                switch purchaseResult {
                case .purchased(let expiryDate, let items):
                    self.showAlert(alert: self.alertWithTitle(title: "Success", message: "Lifetime restored successfully"))
                    
                case .expired(let expiryDate, let items):
                    print("\(productId) is expired since \(expiryDate)\n\(items)\n")
                    self.setPurchasesInValid(product: productId)
                    
                case .notPurchased:
                    print("The user has never purchased \(productId)")
                    self.setPurchasesInValid(product: productId)
                }

            case .error(let error):
                print("Receipt verification failed: \(error)")
            }
        }
    }

Additional context

Previously its worked when Xcode 12 and SwiftyStoreKit 0.15.0. But after update Xcode and podfile its not working

sourov2008 avatar Jun 14 '21 15:06 sourov2008