bizz84 / bizz84/SwiftyStoreKit

Non Consumable restoration not working.

Open
#641 0 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Swift
Stars
6.7k
Forks
801
PR merge metrics
No merged PRs in 30d

Description

## 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.