I’m testing on a real device.
I have a purchaseButton, I press it, the subscription is successful. I stop the app, restart it, and when I press the purchaseButton again, I get an alert with a message “You’re currently subscribed to this..." with Manage/Okay buttons. I press the Okay button, nothing happens, the alert gets dismissed. But if I press the Manage button, .purchaseCancelledError:
gets hit using breakpoints and the alert gets dismissed.
Now the odd thing is when I press the purchaseButton again, it goes straight to .operationAlreadyInProgressForProductError
, at that point I’m able to notify the user that we found their purchase and they can continue on.
So to be clear, the flow is
1- I press the purchaseButton, and after a subscription is initially made, I stop the app
2- After restarting the app, I press the purchaseButton, I get an alert with a message “You’re currently subscribed to this..", however .operationAlreadyInProgressForProductError
never gets hit no matter if I press the alert’s Mange or Okay buttons.
3- I then I press the purchaseButton again, and this time it goes straight to .operationAlreadyInProgressForProductError
.
The issue is what happens in step 3 should really happen in step 2.
The way it works now, the user has to press the button twice for revenueCat to acknowledge their purchase via .operationAlreadyInProgressForProductError
. It looks like a bug.
Code:
func purchaseButtonTapped() {
Purchases.shared.getOfferings { (offerings, error) in
if let error = error as? RevenueCat.ErrorCode { return }
guard let offerings = offerings else { return }
guard let package = offerings.all.first?.value.availablePackages.first else { return }
Purchases.shared.purchase(package: package) { (transaction, info, error, userCancelled) in
if let error = error as? RevenueCat.ErrorCode {
switch error {
case .purchaseCancelledError:
print(“user either pressed the Manage button from the alert or they cancelled the transaction from the actionSheet”)
case .productAlreadyPurchasedError, .operationAlreadyInProgressForProductError :
// notify user that we acknowledge their subscription and they can continue on to the next level
default: break
}
}
if userCancelled { return }
guard let transaction = transaction else { return }
guard let info = info else { return }
let entitlementsInfo: EntitlementInfos = info.entitlements
print("entitlementsInfo: \(entitlementsInfo)")
}
}
}
![](https://uploads-us-west-2.insided.com/revenuecat-en/attachment/c03ca0bc-6ca0-4144-bff9-2342f8d2b4fe.png)